Interface SPivotField

All Known Implementing Classes:
PivotFieldImpl

public interface SPivotField
Represents a field in a pivot table.
Since:
7.0.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    The axis on which this field is placed.
    static enum 
    The sort order for items in this field.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the axis this field is placed on.
    int
    Returns the index into the pivot cache fields that this field references.
    Returns the items in this field.
    Returns the display name of this field.
    default String
    The number format of this row/column/page field's item labels, as an Excel format code — pivotField/@numFmtId (ECMA-376 §18.10.1.69).
    Returns the sort type for items.
    The named subtotal lines this row/column field shows, beyond the single automatic one that isShowSubtotals() toggles — the sumSubtotal / avgSubtotal / … attributes of ECMA-376 §18.10.1.69.
    boolean
    Returns whether this field uses compact display.
    boolean
    isItemHidden(int itemIndex)
    Returns whether the item at the given index is hidden.
    boolean
    Returns whether this field uses outline display.
    boolean
    Returns whether all items are shown (including those with no data).
    default boolean
    Whether this row/column field's groups are expanded.
    default boolean
    Whether this row/column field shows subtotals for its groups (the defaultSubtotal attribute of ECMA-376 §18.10.1.69).
    boolean
    Returns whether subtotals are shown at the top.
    void
    Sets the axis for this field.
    void
    setCompact(boolean compact)
    Sets compact display mode.
    void
    setItemHidden(int itemIndex, boolean hidden)
    Sets the hidden state for the item at the given index.
    default void
    Sets the number format of this field's item labels; null, blank or General clears it.
    void
    setOutline(boolean outline)
    Sets outline display mode.
    default void
    setShowDetail(boolean show)
    Expands or collapses every group of this row/column field.
    default void
    setShowSubtotals(boolean show)
    Sets whether this row/column field shows subtotals for its groups.
    void
    Sets the sort type for items.
    default void
    Sets the named subtotal lines this row/column field shows.
    void
    setSubtotalTop(boolean top)
    Sets whether subtotals are shown at the top.
  • Method Details

    • getName

      String getName()
      Returns the display name of this field.
      Returns:
      the field name
    • getCacheFieldIndex

      int getCacheFieldIndex()
      Returns the index into the pivot cache fields that this field references.
      Returns:
      the cache field index
    • getAxis

      SPivotField.Axis getAxis()
      Returns the axis this field is placed on.
      Returns:
      the axis
    • setAxis

      void setAxis(SPivotField.Axis axis)
      Sets the axis for this field.
      Parameters:
      axis - the axis
    • getSortType

      SPivotField.SortType getSortType()
      Returns the sort type for items.
      Returns:
      the sort type
    • setSortType

      void setSortType(SPivotField.SortType sort)
      Sets the sort type for items.
      Parameters:
      sort - the sort type
    • isCompact

      boolean isCompact()
      Returns whether this field uses compact display.
      Returns:
      true if compact
    • setCompact

      void setCompact(boolean compact)
      Sets compact display mode.
      Parameters:
      compact - true for compact
    • isOutline

      boolean isOutline()
      Returns whether this field uses outline display.
      Returns:
      true if outline
    • setOutline

      void setOutline(boolean outline)
      Sets outline display mode.
      Parameters:
      outline - true for outline
    • isSubtotalTop

      boolean isSubtotalTop()
      Returns whether subtotals are shown at the top.
      Returns:
      true if subtotals at top
    • setSubtotalTop

      void setSubtotalTop(boolean top)
      Sets whether subtotals are shown at the top.
      Parameters:
      top - true for subtotals at top
    • isShowAll

      boolean isShowAll()
      Returns whether all items are shown (including those with no data).
      Returns:
      true if showing all items
    • getItems

      List<SPivotItem> getItems()
      Returns the items in this field.
      Returns:
      list of pivot items
    • isItemHidden

      boolean isItemHidden(int itemIndex)
      Returns whether the item at the given index is hidden.
      Parameters:
      itemIndex - zero-based item index
      Returns:
      true if hidden
    • setItemHidden

      void setItemHidden(int itemIndex, boolean hidden)
      Sets the hidden state for the item at the given index.
      Parameters:
      itemIndex - zero-based item index
      hidden - true to hide
    • isShowSubtotals

      default boolean isShowSubtotals()
      Whether this row/column field shows subtotals for its groups (the defaultSubtotal attribute of ECMA-376 §18.10.1.69).
      Since:
      7.0.0
    • setShowSubtotals

      default void setShowSubtotals(boolean show)
      Sets whether this row/column field shows subtotals for its groups.
      Since:
      7.0.0
    • getSubtotals

      default Set<SubtotalFunction> getSubtotals()
      The named subtotal lines this row/column field shows, beyond the single automatic one that isShowSubtotals() toggles — the sumSubtotal / avgSubtotal / … attributes of ECMA-376 §18.10.1.69. Excel renders one subtotal row per function per group, so a field can show a Sum and an Average subtotal side by side. An empty set is the ordinary case: one subtotal using the field's own aggregate.
      Since:
      7.0.0
    • setSubtotals

      default void setSubtotals(Set<SubtotalFunction> functions)
      Sets the named subtotal lines this row/column field shows. Passing null or an empty set clears them, leaving only setShowSubtotals(boolean).
      Since:
      7.0.0
    • isShowDetail

      default boolean isShowDetail()
      Whether this row/column field's groups are expanded. A collapsed field writes sd="0" on each of its items (ECMA-376 §18.10.1.45), which is how Excel stores a group closed with its "-" button.
      Since:
      7.0.0
    • setShowDetail

      default void setShowDetail(boolean show)
      Expands or collapses every group of this row/column field.
      Since:
      7.0.0
    • getNumberFormat

      default String getNumberFormat()
      The number format of this row/column/page field's item labels, as an Excel format code — pivotField/@numFmtId (ECMA-376 §18.10.1.69). A field of dates keeps its date format through it when the pivot is refreshed. Null when the field has none.
      Since:
      7.0.0
    • setNumberFormat

      default void setNumberFormat(String format)
      Sets the number format of this field's item labels; null, blank or General clears it.
      Since:
      7.0.0