Aspose::Cells::Pivot::PivotFieldGroupSettings class
Contents
[
Hide
]PivotFieldGroupSettings class
Represents the group setting of pivot field.
class PivotFieldGroupSettings
Methods
| Method | Description |
|---|---|
| GetType() | Gets the group type of pivot field. |
| IsNull() const | Checks whether the implementation object is nullptr. |
| explicit operator bool() const | operator bool() |
| operator=(const PivotFieldGroupSettings& src) | operator= |
| PivotFieldGroupSettings() | Default constructor. |
| PivotFieldGroupSettings(PivotFieldGroupSettings_Impl* impl) | Constructs from an implementation object. |
| PivotFieldGroupSettings(const PivotFieldGroupSettings& src) | Copy constructor. |
| ~PivotFieldGroupSettings() | 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);
// FieldTwo is a data field: move it to the row area first,
// because only row/column fields can be grouped
pt.AddFieldToArea(PivotFieldType::Row, u"FieldTwo");
pt.CalculateData();
// Group the numeric field into the ranges 0-1, 2-3, 4-5
PivotFieldGroupOptions options;
options.SetStartNumber(0);
options.SetEndNumber(5);
options.SetInterval(2);
pt.GetRowFields().Get(1).Group(options);
// Calculate the pivot table data and save the output file
pt.CalculateData();
wb.Save(u"outputNumberGroupPivotField.xlsx");
Aspose::Cells::Cleanup();
See Also
- Namespace Aspose::Cells::Pivot
- Library Aspose.Cells for C++