Package io.keikai.model
Interface SPivotTable
- All Known Implementing Classes:
PivotTableImpl
public interface SPivotTable
Represents a pivot table on a sheet.
- Since:
- 7.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumPivot table layout modes. -
Method Summary
Modifier and TypeMethodDescriptionReturns all fields defined in this pivot table.getCache()Returns the pivot cache backing this pivot table.Returns the fields placed on the column axis.default List<SPivotLayoutItem>The<colItems>layoutsetLayoutItems(java.util.List<io.keikai.model.SPivotLayoutItem>, java.util.List<io.keikai.model.SPivotLayoutItem>)supplied; empty when none is.Returns the data (value) fields.getField(int index) Returns the field at the specified index.getFieldByName(String name) Returns the first field matching the given name.default intThefirstDataColsetLocationOffsets(int, int, int)supplied, or -1 when the export derives it from the report layout.default intThefirstDataRowsetLocationOffsets(int, int, int)supplied, or -1 when the export derives it from the report layout.default intThefirstHeaderRowsetLocationOffsets(int, int, int)supplied, or -1 when the export derives it from the report layout.default SPivotTable.LayoutModeReturns the current layout mode.Returns the output location of this pivot table on the sheet.getName()Returns the name of this pivot table.Returns the fields placed on the page (report filter) axis.Returns the fields placed on the row axis.default List<SPivotLayoutItem>The<rowItems>layoutsetLayoutItems(java.util.List<io.keikai.model.SPivotLayoutItem>, java.util.List<io.keikai.model.SPivotLayoutItem>)supplied; empty when none is.default SPivotTableStyleInfoThe style and banding flagssetStyle(java.lang.String, boolean, boolean, boolean, boolean, boolean)applied, or null when no style is applied.booleanReturns whether compact layout is enabled.default booleanWhether the data fields are stacked down the row axis instead of across the column axis — thedataOnRowsattribute of ECMA-376 §18.10.1.73.booleanReturns whether outline layout is enabled.booleanReturns whether the grand total column is shown.booleanReturns whether the grand total row is shown.booleanReturns whether tabular layout is enabled.voidrefresh()Refreshes the pivot table by re-reading data from the cache.voidsetCompactLayout(boolean compact) Sets compact layout mode.default voidsetDataOnRows(boolean onRows) Lays the data fields down the row axis instead of across the column axis.default voidsetLayoutItems(List<SPivotLayoutItem> rowItems, List<SPivotLayoutItem> columnItems) Supplies this pivot's rendered<rowItems>/<colItems>layout.default voidSets the layout mode.default voidsetLocationOffsets(int firstHeaderRow, int firstDataRow, int firstDataCol) Supplies where the header and the data area of a caller-rendered layout start — thefirstHeaderRow,firstDataRowandfirstDataColof<location>(ECMA-376 §18.10.1.49), each zero-based from the top-left cell ofgetLocation().voidSets the name of this pivot table.voidsetOutlineLayout(boolean outline) Sets outline layout mode.voidsetShowGrandTotalColumn(boolean show) Sets visibility of the grand total column.voidsetShowGrandTotalRow(boolean show) Sets visibility of the grand total row.default voidsetStyle(String name, boolean showRowHeaders, boolean showColumnHeaders, boolean showRowStripes, boolean showColumnStripes, boolean showLastColumn) Applies a named pivot style and its banding flags, written as<pivotTableStyleInfo>(ECMA-376 §18.10.1.74).voidsetTabularLayout(boolean tabular) Sets tabular layout mode.
-
Method Details
-
getName
String getName()Returns the name of this pivot table.- Returns:
- the pivot table name
-
setName
Sets the name of this pivot table.- Parameters:
name- the pivot table name
-
getLocation
CellRegion getLocation()Returns the output location of this pivot table on the sheet.- Returns:
- the cell region where the pivot table is rendered
-
getCache
SPivotCache getCache()Returns the pivot cache backing this pivot table.- Returns:
- the pivot cache
-
getRowFields
List<SPivotField> getRowFields()Returns the fields placed on the row axis.- Returns:
- list of row fields
-
getColumnFields
List<SPivotField> getColumnFields()Returns the fields placed on the column axis.- Returns:
- list of column fields
-
getDataFields
List<SPivotDataField> getDataFields()Returns the data (value) fields.- Returns:
- list of data fields
-
getPageFields
List<SPivotField> getPageFields()Returns the fields placed on the page (report filter) axis.- Returns:
- list of page fields
-
getAllFields
List<SPivotField> getAllFields()Returns all fields defined in this pivot table.- Returns:
- list of all fields
-
getField
Returns the field at the specified index.- Parameters:
index- zero-based field index- Returns:
- the pivot field
-
getFieldByName
Returns the first field matching the given name.- Parameters:
name- field name- Returns:
- the matching field, or null if not found
-
getLayoutMode
Returns the current layout mode. Use this in preference to the individualisCompactLayout()/isOutlineLayout()/isTabularLayout()accessors.- Returns:
- the layout mode (never null)
- Since:
- 7.0.0
-
setLayoutMode
Sets the layout mode. Mutually exclusive: switching to one mode turns the others off.- Parameters:
mode- the layout mode (must not be null)- Since:
- 7.0.0
-
isDataOnRows
default boolean isDataOnRows()Whether the data fields are stacked down the row axis instead of across the column axis — thedataOnRowsattribute of ECMA-376 §18.10.1.73. It positions the synthetic "values" field, so it only shows with two or more data fields.- Since:
- 7.0.0
-
setDataOnRows
default void setDataOnRows(boolean onRows) Lays the data fields down the row axis instead of across the column axis.- Since:
- 7.0.0
-
isCompactLayout
boolean isCompactLayout()Returns whether compact layout is enabled.- Returns:
- true if compact layout
-
setCompactLayout
void setCompactLayout(boolean compact) Sets compact layout mode. PrefersetLayoutMode(LayoutMode)for clarity — this setter is kept for backward compatibility.- Parameters:
compact- true to enable compact layout
-
isOutlineLayout
boolean isOutlineLayout()Returns whether outline layout is enabled.- Returns:
- true if outline layout
-
setOutlineLayout
void setOutlineLayout(boolean outline) Sets outline layout mode. PrefersetLayoutMode(LayoutMode).- Parameters:
outline- true to enable outline layout
-
isTabularLayout
boolean isTabularLayout()Returns whether tabular layout is enabled.- Returns:
- true if tabular layout
-
setTabularLayout
void setTabularLayout(boolean tabular) Sets tabular layout mode. PrefersetLayoutMode(LayoutMode).- Parameters:
tabular- true to enable tabular layout
-
isShowGrandTotalRow
boolean isShowGrandTotalRow()Returns whether the grand total row is shown.- Returns:
- true if the grand total row is visible
-
setShowGrandTotalRow
void setShowGrandTotalRow(boolean show) Sets visibility of the grand total row.- Parameters:
show- true to show grand total row
-
isShowGrandTotalColumn
boolean isShowGrandTotalColumn()Returns whether the grand total column is shown.- Returns:
- true if the grand total column is visible
-
setShowGrandTotalColumn
void setShowGrandTotalColumn(boolean show) Sets visibility of the grand total column.- Parameters:
show- true to show grand total column
-
refresh
void refresh()Refreshes the pivot table by re-reading data from the cache.Until the pivot calculation engine is implemented this throws
UnsupportedOperationException(fail-loud) rather than silently no-op'ing, so callers cannot mistake a stale table for a refreshed one.- Throws:
UnsupportedOperationException- until the pivot engine lands
-
setStyle
default void setStyle(String name, boolean showRowHeaders, boolean showColumnHeaders, boolean showRowStripes, boolean showColumnStripes, boolean showLastColumn) Applies a named pivot style and its banding flags, written as<pivotTableStyleInfo>(ECMA-376 §18.10.1.74). A null or blank name clears the style.- Since:
- 7.0.0
-
getStyleInfo
The style and banding flagssetStyle(java.lang.String, boolean, boolean, boolean, boolean, boolean)applied, or null when no style is applied.- Since:
- 7.0.0
-
setLayoutItems
Supplies this pivot's rendered<rowItems>/<colItems>layout. The engine does not model collapsed groups, so a caller that renders its own layout must hand it over for the exported file to match what it displays. Two empty lists restore the default, where the layout is omitted and consumers rebuild it when the file is opened.- Since:
- 7.0.0
-
getRowLayoutItems
The<rowItems>layoutsetLayoutItems(java.util.List<io.keikai.model.SPivotLayoutItem>, java.util.List<io.keikai.model.SPivotLayoutItem>)supplied; empty when none is.- Since:
- 7.0.0
-
getColumnLayoutItems
The<colItems>layoutsetLayoutItems(java.util.List<io.keikai.model.SPivotLayoutItem>, java.util.List<io.keikai.model.SPivotLayoutItem>)supplied; empty when none is.- Since:
- 7.0.0
-
setLocationOffsets
default void setLocationOffsets(int firstHeaderRow, int firstDataRow, int firstDataCol) Supplies where the header and the data area of a caller-rendered layout start — thefirstHeaderRow,firstDataRowandfirstDataColof<location>(ECMA-376 §18.10.1.49), each zero-based from the top-left cell ofgetLocation(). Without them the export derives the offsets from the report layout, which only matches cells laid out the way the engine would lay them out; a caller that renders its own layout (setLayoutItems(java.util.List<io.keikai.model.SPivotLayoutItem>, java.util.List<io.keikai.model.SPivotLayoutItem>)) supplies these so the definition points at the cells it wrote. A negative value restores the derived offsets.- Since:
- 7.0.0
-
getFirstHeaderRow
default int getFirstHeaderRow()ThefirstHeaderRowsetLocationOffsets(int, int, int)supplied, or -1 when the export derives it from the report layout.- Since:
- 7.0.0
-
getFirstDataRow
default int getFirstDataRow()ThefirstDataRowsetLocationOffsets(int, int, int)supplied, or -1 when the export derives it from the report layout.- Since:
- 7.0.0
-
getFirstDataCol
default int getFirstDataCol()ThefirstDataColsetLocationOffsets(int, int, int)supplied, or -1 when the export derives it from the report layout.- Since:
- 7.0.0
-