Interface SPivotTable

All Known Implementing Classes:
PivotTableImpl

public interface SPivotTable
Represents a pivot table on a sheet.
Since:
7.0.0
  • Method Details

    • getName

      String getName()
      Returns the name of this pivot table.
      Returns:
      the pivot table name
    • setName

      void setName(String name)
      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

      SPivotField getField(int index)
      Returns the field at the specified index.
      Parameters:
      index - zero-based field index
      Returns:
      the pivot field
    • getFieldByName

      SPivotField getFieldByName(String name)
      Returns the first field matching the given name.
      Parameters:
      name - field name
      Returns:
      the matching field, or null if not found
    • getLayoutMode

      default SPivotTable.LayoutMode getLayoutMode()
      Returns the current layout mode. Use this in preference to the individual isCompactLayout() / isOutlineLayout() / isTabularLayout() accessors.
      Returns:
      the layout mode (never null)
      Since:
      7.0.0
    • setLayoutMode

      default void setLayoutMode(SPivotTable.LayoutMode mode)
      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 — the dataOnRows attribute 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. Prefer setLayoutMode(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. Prefer setLayoutMode(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. Prefer setLayoutMode(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

      default SPivotTableStyleInfo getStyleInfo()
      The style and banding flags setStyle(java.lang.String, boolean, boolean, boolean, boolean, boolean) applied, or null when no style is applied.
      Since:
      7.0.0
    • setLayoutItems

      default void setLayoutItems(List<SPivotLayoutItem> rowItems, List<SPivotLayoutItem> columnItems)
      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

      default List<SPivotLayoutItem> getRowLayoutItems()
      Since:
      7.0.0
    • getColumnLayoutItems

      default List<SPivotLayoutItem> getColumnLayoutItems()
      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 — the firstHeaderRow, firstDataRow and firstDataCol of <location> (ECMA-376 §18.10.1.49), each zero-based from the top-left cell of getLocation(). 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()
      The firstHeaderRow setLocationOffsets(int, int, int) supplied, or -1 when the export derives it from the report layout.
      Since:
      7.0.0
    • getFirstDataRow

      default int getFirstDataRow()
      The firstDataRow setLocationOffsets(int, int, int) supplied, or -1 when the export derives it from the report layout.
      Since:
      7.0.0
    • getFirstDataCol

      default int getFirstDataCol()
      The firstDataCol setLocationOffsets(int, int, int) supplied, or -1 when the export derives it from the report layout.
      Since:
      7.0.0