public class XSSFPivotTable extends POIXMLDocumentPart
Modifier and Type | Class and Description |
---|---|
protected static interface |
XSSFPivotTable.PivotTableReferenceConfigurator |
POIXMLDocumentPart.RelationPart
Modifier and Type | Field and Description |
---|---|
protected static short |
CREATED_VERSION |
protected static short |
MIN_REFRESHABLE_VERSION |
protected static short |
UPDATED_VERSION |
Modifier | Constructor and Description |
---|---|
protected |
XSSFPivotTable() |
protected |
XSSFPivotTable(PackagePart part)
Creates an XSSFPivotTable representing the given package part and relationship.
(创建一个表示给定包部分和关系的 XSSFPivotTable。)
|
Modifier and Type | Method and Description |
---|---|
void |
addColLabel(int columnIndex)
Add a col label using data from the given column.
(使用给定列中的数据添加 col 标签。)
|
void |
addColLabel(int columnIndex, java.lang.String valueFormat)
Add a col label using data from the given column.
(使用给定列中的数据添加 col 标签。)
|
void |
addColumnLabel(DataConsolidateFunction function, int columnIndex)
Add a column label using data from the given column and specified function
(使用给定列和指定函数中的数据添加列标签)
|
void |
addColumnLabel(DataConsolidateFunction function, int columnIndex, java.lang.String valueFieldName)
Add a column label using data from the given column and specified function
(使用给定列和指定函数中的数据添加列标签)
|
void |
addColumnLabel(DataConsolidateFunction function, int columnIndex, java.lang.String valueFieldName, java.lang.String valueFormat)
Add a column label using data from the given column and specified function
(使用给定列和指定函数中的数据添加列标签)
|
void |
addDataColumn(int columnIndex, boolean isDataField)
Add column containing data from the referenced area.
(添加包含来自引用区域的数据的列。)
|
void |
addReportFilter(int columnIndex)
Add filter for the column with the corresponding index and cell value
(为具有相应索引和单元格值的列添加过滤器)
|
void |
addRowLabel(int columnIndex)
Add a row label using data from the given column.
(使用给定列中的数据添加行标签。)
|
protected void |
commit()
Save the content in the underlying package part.
(将内容保存在底层包部分中。)
|
protected void |
createDefaultDataColumns() |
protected void |
createSourceReferences(CellReference position, Sheet sourceSheet, XSSFPivotTable.PivotTableReferenceConfigurator refConfig)
Creates cacheSource and workSheetSource for pivot table and sets the source reference as well assets the location of the pivot table
(为数据透视表创建 cacheSource 和 workSheetSource 并设置源引用以及资产数据透视表的位置)
|
java.util.List<java.lang.Integer> |
getColLabelColumns() |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableDefinition |
getCTPivotTableDefinition() |
Sheet |
getDataSheet() |
Sheet |
getParentSheet() |
protected AreaReference |
getPivotArea() |
XSSFPivotCache |
getPivotCache() |
XSSFPivotCacheDefinition |
getPivotCacheDefinition() |
XSSFPivotCacheRecords |
getPivotCacheRecords() |
java.util.List<java.lang.Integer> |
getRowLabelColumns() |
void |
readFrom(java.io.InputStream is) |
void |
setCTPivotTableDefinition(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableDefinition pivotTableDefinition) |
protected void |
setDefaultPivotTableDefinition()
Set default values for the table definition.
(为表定义设置默认值。)
|
void |
setParentSheet(XSSFSheet parentSheet) |
void |
setPivotCache(XSSFPivotCache pivotCache) |
void |
setPivotCacheDefinition(XSSFPivotCacheDefinition pivotCacheDefinition) |
void |
setPivotCacheRecords(XSSFPivotCacheRecords pivotCacheRecords) |
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
protected static final short CREATED_VERSION
protected static final short MIN_REFRESHABLE_VERSION
protected static final short UPDATED_VERSION
@Beta protected XSSFPivotTable()
@Beta protected XSSFPivotTable(PackagePart part) throws java.io.IOException
part
- - The package part that holds xml data representing this pivot table.
(part - 包含表示此数据透视表的 xml 数据的包部分。)
java.io.IOException
(java.io.IOException)
@Beta public void readFrom(java.io.InputStream is) throws java.io.IOException
java.io.IOException
(java.io.IOException)
@Beta public void setPivotCache(XSSFPivotCache pivotCache)
@Beta public XSSFPivotCache getPivotCache()
@Beta @Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableDefinition getCTPivotTableDefinition()
@Beta @Internal public void setCTPivotTableDefinition(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableDefinition pivotTableDefinition)
@Beta public XSSFPivotCacheDefinition getPivotCacheDefinition()
@Beta public void setPivotCacheDefinition(XSSFPivotCacheDefinition pivotCacheDefinition)
@Beta public XSSFPivotCacheRecords getPivotCacheRecords()
@Beta public void setPivotCacheRecords(XSSFPivotCacheRecords pivotCacheRecords)
@Beta protected void commit() throws java.io.IOException
POIXMLDocumentPart
Sub-classes should override and add logic to marshal the "model" into Ooxml4J.
For example, the code saving a generic XML entry may look as follows:
protected void commit() throws IOException { PackagePart part = getPackagePart(); OutputStream out = part.getOutputStream(); XmlObject bean = getXmlBean(); //the "model" which holds changes in memory bean.save(out, DEFAULT_XML_OPTIONS); out.close(); }(将内容保存在底层包部分中。默认实现是空的,这意味着包部分保持不变。子类应覆盖并添加逻辑以将“模型”编组到 Ooxml4J。例如,保存通用 XML 条目的代码可能如下所示: protected void commit() throws IOException { PackagePart part = getPackagePart();输出流输出 = part.getOutputStream(); XmlObject bean = getXmlBean(); //保存内存变化的“模型” bean.save(out, DEFAULT_XML_OPTIONS); out.close(); })
commit
in class
POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException if the changes can't be committed
(java.io.IOException - 如果无法提交更改,子类可能会抛出 IOException)
@Beta protected void setDefaultPivotTableDefinition()
protected AreaReference getPivotArea()
@Beta public void addRowLabel(int columnIndex)
columnIndex
- the index of the source column to be used as row label.
columnIndex
is 0-based indexed and relative to the first column in the source.
(columnIndex - 用作行标签的源列的索引。 columnIndex 是基于 0 的索引,并且相对于源中的第一列。)
@Beta public java.util.List<java.lang.Integer> getRowLabelColumns()
@Beta public void addColLabel(int columnIndex, java.lang.String valueFormat)
columnIndex
- the index of the source column to be used as row label.
columnIndex
is 0-based indexed and relative to the first column in the source.
(columnIndex - 用作行标签的源列的索引。 columnIndex 是基于 0 的索引,并且相对于源中的第一列。)
valueFormat
- format of column value (e.g. for date: "DD.MM.YYYY")
(valueFormat - 列值的格式(例如日期:“DD.MM.YYYY”))
@Beta public void addColLabel(int columnIndex)
columnIndex
- the index of the source column to be used as row label.
columnIndex
is 0-based indexed and relative to the first column in the source.
(columnIndex - 用作行标签的源列的索引。 columnIndex 是基于 0 的索引,并且相对于源中的第一列。)
@Beta public java.util.List<java.lang.Integer> getColLabelColumns()
@Beta public void addColumnLabel(DataConsolidateFunction function, int columnIndex, java.lang.String valueFieldName, java.lang.String valueFormat)
columnIndex
- the index of the source column to be used as column label.
columnIndex
is 0-based indexed and relative to the first column in the source.
(columnIndex - 用作列标签的源列的索引。 columnIndex 是基于 0 的索引,并且相对于源中的第一列。)
function
- the function to be used on the data The following functions exists: Sum, Count, Average, Max, Min, Product, Count numbers, StdDev, StdDevp, Var, Varp
(function - 用于数据的函数存在以下函数:Sum、Count、Average、Max、Min、Product、Count numbers、StdDev、StdDevp、Var、Varp)
valueFieldName
- the name of pivot table value field
(valueFieldName - 数据透视表值字段的名称)
valueFormat
- format of value field (e.g. "#,##0.00")
(valueFormat - 值字段的格式(例如“#,##0.00”))
@Beta public void addColumnLabel(DataConsolidateFunction function, int columnIndex, java.lang.String valueFieldName)
columnIndex
- the index of the source column to be used as column label.
columnIndex
is 0-based indexed and relative to the first column in the source.
(columnIndex - 用作列标签的源列的索引。 columnIndex 是基于 0 的索引,并且相对于源中的第一列。)
function
- the function to be used on the data The following functions exists: Sum, Count, Average, Max, Min, Product, Count numbers, StdDev, StdDevp, Var, Varp
(function - 用于数据的函数存在以下函数:Sum、Count、Average、Max、Min、Product、Count numbers、StdDev、StdDevp、Var、Varp)
valueFieldName
- the name of pivot table value field
(valueFieldName - 数据透视表值字段的名称)
@Beta public void addColumnLabel(DataConsolidateFunction function, int columnIndex)
columnIndex
- the index of the source column to be used as column label
columnIndex
is 0-based indexed and relative to the first column in the source..
(columnIndex - 用作列标签 columnIndex 的源列的索引是基于 0 的索引,并且相对于源中的第一列。)
function
- the function to be used on the data The following functions exists: Sum, Count, Average, Max, Min, Product, Count numbers, StdDev, StdDevp, Var, Varp
(function - 用于数据的函数存在以下函数:Sum、Count、Average、Max、Min、Product、Count numbers、StdDev、StdDevp、Var、Varp)
@Beta public void addDataColumn(int columnIndex, boolean isDataField)
columnIndex
- the index of the column containing the data
(columnIndex - 包含数据的列的索引)
isDataField
- true if the data should be displayed in the pivot table.
(isDataField - 如果数据应显示在数据透视表中,则为 true。)
@Beta public void addReportFilter(int columnIndex)
columnIndex
- index of column to filter on
(columnIndex - 要过滤的列的索引)
@Beta protected void createSourceReferences(CellReference position, Sheet sourceSheet, XSSFPivotTable.PivotTableReferenceConfigurator refConfig)
position
- Position for pivot table in sheet
(position - 工作表中数据透视表的位置)
sourceSheet
- Sheet where the source will be collected from
(sourceSheet - 从中收集源的工作表)
refConfig
- an configurator that knows how to configure pivot table references
(refConfig - 一个知道如何配置数据透视表引用的配置器)
@Beta protected void createDefaultDataColumns()
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.