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.

Tue May 21, 2019 1:44 pm

Is there an option in Spire.Xls API to hide expand/collapse buttons in pivot tables? I am trying to generate excel using tamplate, that already contains pivot tables. In template, pivot tables don't have option Show expand/collapse button set. After I load template, I'm using Spire API to populate Worksheet, that is used as Data source for pivot tables. In generated excel, pivot tables have overriden option Show expand/collapse button set to true. (I would like, to remain false)

tatijana.jankovic
 
Posts: 1
Joined: Thu May 16, 2019 1:28 pm

Wed May 22, 2019 9:20 am

Hello,

Thanks for your inquiry.
Please refer to the following sample code to hide expand/collapse button in pivot table, if there is any question, just feel free to write back.
Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile(@"Sample.xlsx");
Worksheet sheet = workbook.Worksheets[0];
// Access the PivotTable
XlsPivotTable pt = sheet.PivotTables[0] as XlsPivotTable;
// Access the data field.
PivotDataField pivotDataField = pt.DataFields[0];
//hide expand/collapse button in pivot table
pt.Options.ShowDrillIndicators = false;
workbook.SaveToFile("result.xlsx", ExcelVersion.Version2013);

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1271
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.XLS