Package org.apache.poi.xssf.usermodel
Class XSSFPivotTable
java.lang.Object
org.apache.poi.ooxml.POIXMLDocumentPart
org.apache.poi.xssf.usermodel.XSSFPivotTable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceNested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
POIXMLDocumentPart.RelationPart -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final shortprotected static final shortprotected static final short -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedXSSFPivotTable(PackagePart part) Creates an XSSFPivotTable representing the given package part and relationship. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColLabel(int columnIndex) Add a col label using data from the given column.voidaddColLabel(int columnIndex, String valueFormat) Add a col label using data from the given column.voidaddColumnLabel(DataConsolidateFunction function, int columnIndex) Add a column label using data from the given column and specified functionvoidaddColumnLabel(DataConsolidateFunction function, int columnIndex, String valueFieldName) Add a column label using data from the given column and specified functionvoidaddColumnLabel(DataConsolidateFunction function, int columnIndex, String valueFieldName, String valueFormat) Add a column label using data from the given column and specified functionvoidaddDataColumn(int columnIndex, boolean isDataField) Add column containing data from the referenced area.voidaddReportFilter(int columnIndex) Add filter for the column with the corresponding index and cell valuevoidaddRowLabel(int columnIndex) Add a row label using data from the given column.protected voidcommit()Save the content in the underlying package part.protected voidprotected voidcreateSourceReferences(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 tableorg.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableDefinitionprotected AreaReferencevoidreadFrom(InputStream is) voidsetCTPivotTableDefinition(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableDefinition pivotTableDefinition) protected voidSet default values for the table definition.voidsetParentSheet(XSSFSheet parentSheet) voidsetPivotCache(XSSFPivotCache pivotCache) voidsetPivotCacheDefinition(XSSFPivotCacheDefinition pivotCacheDefinition) voidsetPivotCacheRecords(XSSFPivotCacheRecords pivotCacheRecords) Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommited, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommited, toString
-
Field Details
-
CREATED_VERSION
protected static final short CREATED_VERSION- See Also:
-
MIN_REFRESHABLE_VERSION
protected static final short MIN_REFRESHABLE_VERSION- See Also:
-
UPDATED_VERSION
protected static final short UPDATED_VERSION- See Also:
-
-
Constructor Details
-
XSSFPivotTable
-
XSSFPivotTable
Creates an XSSFPivotTable representing the given package part and relationship. Should only be called when reading in an existing file.- Parameters:
part- - The package part that holds xml data representing this pivot table.- Throws:
IOException- Since:
- POI 3.14-Beta1
-
-
Method Details
-
readFrom
- Throws:
IOException
-
setPivotCache
-
getPivotCache
-
getParentSheet
-
setParentSheet
-
getCTPivotTableDefinition
-
setCTPivotTableDefinition
-
getPivotCacheDefinition
-
setPivotCacheDefinition
-
getPivotCacheRecords
-
setPivotCacheRecords
-
getDataSheet
-
commit
Description copied from class:POIXMLDocumentPartSave the content in the underlying package part. Default implementation is empty meaning that the package part is left unmodified.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(); }- Overrides:
commitin classPOIXMLDocumentPart- Throws:
IOException- a subclass may throw an IOException if the changes can't be committed
-
setDefaultPivotTableDefinition
Set default values for the table definition. -
getPivotArea
-
addRowLabel
Add a row label using data from the given column.- Parameters:
columnIndex- the index of the source column to be used as row label.columnIndexis 0-based indexed and relative to the first column in the source.
-
getRowLabelColumns
-
addColLabel
Add a col label using data from the given column.- Parameters:
columnIndex- the index of the source column to be used as row label.columnIndexis 0-based indexed and relative to the first column in the source.valueFormat- format of column value (e.g. for date: "DD.MM.YYYY")
-
addColLabel
Add a col label using data from the given column.- Parameters:
columnIndex- the index of the source column to be used as row label.columnIndexis 0-based indexed and relative to the first column in the source.
-
getColLabelColumns
-
addColumnLabel
@Beta public void addColumnLabel(DataConsolidateFunction function, int columnIndex, String valueFieldName, String valueFormat) Add a column label using data from the given column and specified function- Parameters:
columnIndex- the index of the source column to be used as column label.columnIndexis 0-based indexed and relative to the first column in the source.function- the function to be used on the data The following functions exists: Sum, Count, Average, Max, Min, Product, Count numbers, StdDev, StdDevp, Var, VarpvalueFieldName- the name of pivot table value fieldvalueFormat- format of value field (e.g. "#,##0.00")
-
addColumnLabel
@Beta public void addColumnLabel(DataConsolidateFunction function, int columnIndex, String valueFieldName) Add a column label using data from the given column and specified function- Parameters:
columnIndex- the index of the source column to be used as column label.columnIndexis 0-based indexed and relative to the first column in the source.function- the function to be used on the data The following functions exists: Sum, Count, Average, Max, Min, Product, Count numbers, StdDev, StdDevp, Var, VarpvalueFieldName- the name of pivot table value field
-
addColumnLabel
Add a column label using data from the given column and specified function- Parameters:
columnIndex- the index of the source column to be used as column labelcolumnIndexis 0-based indexed and relative to the first column in the source..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
-
addDataColumn
Add column containing data from the referenced area.- Parameters:
columnIndex- the index of the column containing the dataisDataField- true if the data should be displayed in the pivot table.
-
addReportFilter
Add filter for the column with the corresponding index and cell value- Parameters:
columnIndex- index of column to filter on
-
createSourceReferences
@Beta 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- Parameters:
position- Position for pivot table in sheetsourceSheet- Sheet where the source will be collected fromrefConfig- an configurator that knows how to configure pivot table references
-
createDefaultDataColumns
-