org.apache.poi.xssf.usermodel
Class XSSFPivotTable

java.lang.Object
  extended by org.apache.poi.POIXMLDocumentPart
      extended by org.apache.poi.xssf.usermodel.XSSFPivotTable

public class XSSFPivotTable
extends POIXMLDocumentPart


Nested Class Summary
protected static interface XSSFPivotTable.PivotTableReferenceConfigurator
           
 
Nested classes/interfaces inherited from class org.apache.poi.POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
 
Field Summary
protected static short CREATED_VERSION
           
protected static short MIN_REFRESHABLE_VERSION
           
protected static short UPDATED_VERSION
           
 
Constructor Summary
protected XSSFPivotTable()
           
protected XSSFPivotTable(PackagePart part)
          Creates an XSSFPivotTable representing the given package part and relationship.
 
Method Summary
 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 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
 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)
           
 
Methods inherited from class org.apache.poi.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationParts, getRelations, getTargetPart, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CREATED_VERSION

protected static final short CREATED_VERSION
See Also:
Constant Field Values

MIN_REFRESHABLE_VERSION

protected static final short MIN_REFRESHABLE_VERSION
See Also:
Constant Field Values

UPDATED_VERSION

protected static final short UPDATED_VERSION
See Also:
Constant Field Values
Constructor Detail

XSSFPivotTable

@Beta
protected XSSFPivotTable()

XSSFPivotTable

@Beta
protected XSSFPivotTable(PackagePart part)
                  throws java.io.IOException
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:
java.io.IOException
Since:
POI 3.14-Beta1
Method Detail

readFrom

@Beta
public void readFrom(java.io.InputStream is)
              throws java.io.IOException
Throws:
java.io.IOException

setPivotCache

@Beta
public void setPivotCache(XSSFPivotCache pivotCache)

getPivotCache

@Beta
public XSSFPivotCache getPivotCache()

getParentSheet

@Beta
public Sheet getParentSheet()

setParentSheet

@Beta
public void setParentSheet(XSSFSheet parentSheet)

getCTPivotTableDefinition

@Beta
@Internal
public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableDefinition getCTPivotTableDefinition()

setCTPivotTableDefinition

@Beta
@Internal
public void setCTPivotTableDefinition(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableDefinition pivotTableDefinition)

getPivotCacheDefinition

@Beta
public XSSFPivotCacheDefinition getPivotCacheDefinition()

setPivotCacheDefinition

@Beta
public void setPivotCacheDefinition(XSSFPivotCacheDefinition pivotCacheDefinition)

getPivotCacheRecords

@Beta
public XSSFPivotCacheRecords getPivotCacheRecords()

setPivotCacheRecords

@Beta
public void setPivotCacheRecords(XSSFPivotCacheRecords pivotCacheRecords)

getDataSheet

@Beta
public Sheet getDataSheet()

commit

@Beta
protected void commit()
               throws java.io.IOException
Description copied from class: POIXMLDocumentPart
Save 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:
commit in class POIXMLDocumentPart
Throws:
java.io.IOException - a subclass may throw an IOException if the changes can't be committed

setDefaultPivotTableDefinition

@Beta
protected void setDefaultPivotTableDefinition()
Set default values for the table definition.


getPivotArea

protected AreaReference getPivotArea()

addRowLabel

@Beta
public void addRowLabel(int columnIndex)
Add a row label using data from the given column.

Parameters:
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.

getRowLabelColumns

@Beta
public java.util.List<java.lang.Integer> getRowLabelColumns()

addColumnLabel

@Beta
public void addColumnLabel(DataConsolidateFunction function,
                                int columnIndex,
                                java.lang.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. columnIndex is 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
valueFieldName - the name of pivot table value field

addColumnLabel

@Beta
public void addColumnLabel(DataConsolidateFunction function,
                                int columnIndex)
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 columnIndex is 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

@Beta
public void addDataColumn(int columnIndex,
                               boolean isDataField)
Add column containing data from the referenced area.

Parameters:
columnIndex - the index of the column containing the data
isDataField - true if the data should be displayed in the pivot table.

addReportFilter

@Beta
public void addReportFilter(int columnIndex)
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 sheet
sourceSheet - Sheet where the source will be collected from
refConfig - an configurator that knows how to configure pivot table references

createDefaultDataColumns

@Beta
protected void createDefaultDataColumns()


Copyright 2017 The Apache Software Foundation or its licensors, as applicable.