I need to export a plain Excel table with several columns. Based on this table I want to build a Pivot table on the second sheet. One of the columns has dates. If I add this field in the list of Pivot fields manually in Excel, also two additional columns for year and quater are selected as rows.
How can I achieve this with XlsIo?
var pivotSheet = workbook.Worksheets;
IPivotCache cache = workbook.PivotCaches.Add(sheet.Range[1, 1, row - 1, maxCol]);
IPivotTable pivotTable = pivotSheet.PivotTables.Add("PivotTable1", pivotSheet["A1"], cache);
pivotTable.Fields.Axis = PivotAxisTypes.Row; // Created <- the date column
pivotTable.Fields.Axis = PivotAxisTypes.Page; // Costcenter
pivotTable.Fields.Axis = PivotAxisTypes.Row; // Creator
pivotTable.Fields.Axis = PivotAxisTypes.Column; // Status
var iDField = pivotTable.Fields;
pivotTable.DataFields.Add(iDField, "Count", PivotSubtotalTypes.Count);
Christian, as of now Syncfusion XlsIO do not have support for adding quarters and years. We will analyze on providing support for this and will share you the details in 2 business days, on January 23rd, 2023.
We are still analyzing on providing support and will share further details on January 25th, 2023.
We appreciate your patience.
Christian, we have logged a feature report to provide Support for Quarters and Years field for Date field in pivot table but do not have any immediate plans to implement this feature in near future.
You can track the status of this feature report through below feedback link.