Aspose::Cells::Pivot::PivotFieldGroupOptions class
Contents
[
Hide
]PivotFieldGroupOptions class
Options for pivot field grouping settings.
class PivotFieldGroupOptions
Methods
| Method | Description |
|---|---|
| GetDiscreteGroupItems() | Gets and sets discrete group items. |
| GetEndDate() | Gets or sets the end value of the grouping range. |
| GetEndNumber() | Gets or sets the end value of the grouping range. |
| GetGroupType() | Gets or sets the grouping type for pivot field. Only for grouping date time pivot field. |
| GetGroupTypes() | Gets or sets the grouping type for pivot field. |
| GetInterval() | Gets or sets the interval size for each group. |
| GetNewPivotField() | Gets or sets a value indicating whether new pivot fields should be created after grouping. |
| GetStartDate() | Gets or sets the start value of the grouping range. |
| GetStartNumber() | Gets or sets the start value of the grouping range. |
| IsAutoEnd() | Gets or sets a value indicating whether the end value is automatically determined. |
| IsAutoStart() | Gets or sets a value indicating whether the start value is automatically determined. |
| IsNull() const | Checks whether the implementation object is nullptr. |
| explicit operator bool() const | operator bool() |
| operator=(const PivotFieldGroupOptions& src) | operator= |
| PivotFieldGroupOptions() | Default constructor. |
| PivotFieldGroupOptions(PivotFieldGroupOptions_Impl* impl) | Constructs from an implementation object. |
| PivotFieldGroupOptions(const PivotFieldGroupOptions& src) | Copy constructor. |
| SetDiscreteGroupItems(const Vector <DiscreteGroupItem>& value) | Gets and sets discrete group items. |
| SetEndDate(const Date& value) | Gets or sets the end value of the grouping range. |
| SetEndNumber(double value) | Gets or sets the end value of the grouping range. |
| SetGroupType(PivotGroupByType value) | Gets or sets the grouping type for pivot field. Only for grouping date time pivot field. |
| SetGroupTypes(const Vector <PivotGroupByType>& value) | Gets or sets the grouping type for pivot field. |
| SetInterval(double value) | Gets or sets the interval size for each group. |
| SetIsAutoEnd(bool value) | Gets or sets a value indicating whether the end value is automatically determined. |
| SetIsAutoStart(bool value) | Gets or sets a value indicating whether the start value is automatically determined. |
| SetNewPivotField(bool value) | Gets or sets a value indicating whether new pivot fields should be created after grouping. |
| SetStartDate(const Date& value) | Gets or sets the start value of the grouping range. |
| SetStartNumber(double value) | Gets or sets the start value of the grouping range. |
| ~PivotFieldGroupOptions() | Destructor. |
Fields
| Field | Description |
|---|---|
| _impl | The implementation object. |
Examples
Aspose::Cells::Startup();
// Load the sample workbook
Workbook wb(u"sampleGroupPivotFieldsInPivotTable.xlsx");
// Access the second worksheet and its pivot table
PivotTable pt = wb.GetWorksheets().Get(1).GetPivotTables().Get(0);
// Group the first row field (a date field) by months and quarters
PivotFieldGroupOptions options;
options.SetStartDate(Date{2008, 1, 1});
options.SetEndDate(Date{2008, 9, 5});
options.SetGroupTypes(Vector<PivotGroupByType>{ PivotGroupByType::Months, PivotGroupByType::Quarters });
pt.GetRowFields().Get(0).Group(options);
// Calculate the pivot table data and save the output file
pt.CalculateData();
wb.Save(u"outputGroupPivotFieldsInPivotTable.xlsx");
Aspose::Cells::Cleanup();
See Also
- Namespace Aspose::Cells::Pivot
- Library Aspose.Cells for C++