Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Wed Aug 16, 2023 7:45 pm

How do you set the custom name of a PivotField in C#? As seen in this Excel screenshot:

Pivot Field custom name.png
Pivot Field custom name.png (11.85 KiB) Viewed 2459 times

DaMiller
 
Posts: 8
Joined: Thu Jan 12, 2023 9:12 pm

Thu Aug 17, 2023 3:29 am

Hi,

Thanks for your inquiry.
Currently, this attribute is read only, I have recorded this new feature with the ticket number SPIREXLS-4857, and our developers will evaluate and try to implement it, once the new feature is implemented, I will inform you asap.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Wed Oct 18, 2023 8:20 am

Hi,

Thanks for your patience.
Glad to inform you that we just released Spire.Xls 13.10.1 hotfix, which has implemented the new feature SPIREXLS-4857, please refer to the following code.
Code: Select all
 sheet.PivotTables[0].RowFields[0].CustomName = "rowName";
 sheet.PivotTables[0].ColumnFields[0].CustomName = "colName";
 sheet.PivotTables[0].PivotFields[0].CustomName = "fieldName0";
 sheet.PivotTables[0].DataFields[0].CustomName = "DataName";
 (sheet.PivotTables[0] as XlsPivotTable).CalculateData();

Website link: https://www.e-iceblue.com/Download/download-excel-for-net-now.html

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.XLS