[]
        
(Showing Draft Content)

PivotFieldDateGroupOptions

Class PivotFieldDateGroupOptions

java.lang.Object
com.grapecity.documents.excel.PivotFieldDateGroupOptions

public class PivotFieldDateGroupOptions extends Object
Represents the settings used to group a PivotField by date or time units.

Use this class to configure the date range and the date or time units used by IPivotField.group(PivotFieldDateGroupOptions). By default, the group range is determined from the PivotCache and the field is grouped by PivotFieldDateGroupBy.Months.


 PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
 options.setGroupBy(java.util.Arrays.asList(PivotFieldDateGroupBy.Months, PivotFieldDateGroupBy.Years));
 options.setAutoStart(true);
 options.setAutoEnd(true);
 List<PivotFieldDateGroupBy> groupBy = options.getGroupBy();
 
  • Constructor Details

    • PivotFieldDateGroupOptions

      public PivotFieldDateGroupOptions()
      Creates date grouping settings with the default range and group unit.

      The default settings determine the start and end dates from the PivotCache, group by PivotFieldDateGroupBy.Months, and use 1 day per group when day grouping is enabled.

  • Method Details

    • getStart

      public LocalDateTime getStart()
      Gets the first date included in the grouped range.

      When getAutoStart() is true, this value is ignored and the first date is determined from the PivotCache.

      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setStart(LocalDateTime.of(2024, 1, 1, 0, 0));
       LocalDateTime start = options.getStart();
       
      Returns:
      The first date included in the grouped range. Returns null if no explicit start date is set.
    • setStart

      public void setStart(LocalDateTime value)
      Sets the first date included in the grouped range.

      When getAutoStart() is true, this value is ignored and the first date is determined from the PivotCache.

      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setStart(LocalDateTime.of(2024, 1, 1, 0, 0));
       LocalDateTime start = options.getStart();
       
      Parameters:
      value - The first date included in the grouped range. Use null to clear the explicit start date.
    • getEnd

      public LocalDateTime getEnd()
      Gets the last date included in the grouped range.

      When getAutoEnd() is true, this value is ignored and the last date is determined from the PivotCache.

      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setEnd(LocalDateTime.of(2024, 12, 31, 0, 0));
       LocalDateTime end = options.getEnd();
       
      Returns:
      The last date included in the grouped range. Returns null if no explicit end date is set.
    • setEnd

      public void setEnd(LocalDateTime value)
      Sets the last date included in the grouped range.

      When getAutoEnd() is true, this value is ignored and the last date is determined from the PivotCache.

      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setEnd(LocalDateTime.of(2024, 12, 31, 0, 0));
       LocalDateTime end = options.getEnd();
       
      Parameters:
      value - The last date included in the grouped range. Use null to clear the explicit end date.
    • getAutoStart

      public boolean getAutoStart()
      Gets whether the first date is determined from the PivotCache instead of getStart().
      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setAutoStart(false);
       boolean autoStart = options.getAutoStart();
       
      Returns:
      true if the first date is determined from the PivotCache instead of getStart(); otherwise, false.
    • setAutoStart

      public void setAutoStart(boolean value)
      Sets whether the first date is determined from the PivotCache instead of getStart().
      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setAutoStart(false);
       boolean autoStart = options.getAutoStart();
       
      Parameters:
      value - true to determine the first date from the PivotCache; false to use the value set by setStart(LocalDateTime). When this is false, a start date is required when grouping is applied.
    • getAutoEnd

      public boolean getAutoEnd()
      Gets whether the last date is determined from the PivotCache instead of getEnd().
      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setAutoEnd(false);
       boolean autoEnd = options.getAutoEnd();
       
      Returns:
      true if the last date is determined from the PivotCache instead of getEnd(); otherwise, false.
    • setAutoEnd

      public void setAutoEnd(boolean value)
      Sets whether the last date is determined from the PivotCache instead of getEnd().
      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setAutoEnd(false);
       boolean autoEnd = options.getAutoEnd();
       
      Parameters:
      value - true to determine the last date from the PivotCache; false to use the value set by setEnd(LocalDateTime). When this is false, an end date is required when grouping is applied.
    • getGroupBy

      public List<PivotFieldDateGroupBy> getGroupBy()
      Gets the date and time units used to create the grouped PivotField.

      The returned list is a copy. Modifying it does not change this object; use setGroupBy(Collection) to update the grouping units. When multiple units are used, grouping is applied in the standard order from seconds through years.

      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setGroupBy(java.util.Arrays.asList(PivotFieldDateGroupBy.Months, PivotFieldDateGroupBy.Years));
       List<PivotFieldDateGroupBy> groupBy = options.getGroupBy();
       
      Returns:
      The date and time units used to create the grouped PivotField.
    • setGroupBy

      public void setGroupBy(Collection<PivotFieldDateGroupBy> value)
      Sets the date and time units used to create the grouped PivotField.
      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setGroupBy(java.util.Arrays.asList(PivotFieldDateGroupBy.Months, PivotFieldDateGroupBy.Years));
       List<PivotFieldDateGroupBy> groupBy = options.getGroupBy();
       
      Parameters:
      value - The date and time units used to create the grouped PivotField. Use null to clear the grouping units. At least one unit is required when grouping is applied.
    • getDays

      public double getDays()
      Gets the number of days in each generated group when getGroupBy() includes PivotFieldDateGroupBy.Days.
      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setGroupBy(java.util.Arrays.asList(PivotFieldDateGroupBy.Days));
       options.setDays(7);
       double days = options.getDays();
       
      Returns:
      The number of days in each generated group. The default value is 1.
    • setDays

      public void setDays(double value)
      Sets the number of days in each generated group when getGroupBy() includes PivotFieldDateGroupBy.Days.

      This value is used when PivotFieldDateGroupBy.Days is included in getGroupBy(). It must be a finite whole number greater than 0 when grouping is applied. The effective start date must also be earlier than the effective end date.

      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setGroupBy(java.util.Arrays.asList(PivotFieldDateGroupBy.Days));
       options.setDays(7);
       double days = options.getDays();
       
      Parameters:
      value - The number of days in each generated group.
    • getAddGeneratedFieldsToLayout

      public boolean getAddGeneratedFieldsToLayout()
      Gets whether generated group fields are automatically added to the PivotTable layout.
      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setAddGeneratedFieldsToLayout(false);
       boolean addGeneratedFields = options.getAddGeneratedFieldsToLayout();
       
      Returns:
      true if generated group fields are automatically added to the PivotTable layout; otherwise, false. The default value is true.
    • setAddGeneratedFieldsToLayout

      public void setAddGeneratedFieldsToLayout(boolean value)
      Sets whether generated group fields are automatically added to the PivotTable layout.
      
       PivotFieldDateGroupOptions options = new PivotFieldDateGroupOptions();
       options.setAddGeneratedFieldsToLayout(false);
       boolean addGeneratedFields = options.getAddGeneratedFieldsToLayout();
       
      Parameters:
      value - true to add generated group fields to the PivotTable layout automatically; false to keep them hidden.