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.

Fri May 30, 2014 7:31 am

Hello,

The issue about setting background color for subtotals pivot has been resolved. Please download and test the new hotfix Spire.Office Platinum (Hot Fix) Version:2.8.2 (http://www.e-iceblue.com/Download/downl ... t-now.html).
If you get any questions, welcome to get it back to us.

Thanks and Regards,
Benjamin
E-iceblue support team
User avatar

Benjamin Du
 
Posts: 82
Joined: Thu Jul 25, 2013 2:38 am

Tue Mar 09, 2021 12:57 pm

with the current version the imppstation of the Backcolor in the pivot gives me error how can I do ??
Thank you

version Spire.xls 11.2.3.0

program:
string styleName = "newone";
pt.CustomTableStyleName = styleName;
PivotTableStyle pivotTableStyle = new PivotTableStyle(styleName);
PivotStyle pivotStyle = book.CreatePivotStyle();
pivotStyle.Fill.PatternColorObject.SetKnownColor(ExcelColors.Blue);

//apply the style where you need to add
pivotTableStyle.Styles.Add(PivotTableElement.thirdSubtotalRow, pivotStyle);
book.AddPivotTableStyle(pivotTableStyle);


Error: Impossibile find method System Drawing

Grazie mille

ict@sogedin.it
 
Posts: 63
Joined: Mon Jul 15, 2013 2:06 pm

Tue Mar 09, 2021 1:40 pm

sorry, let me explain better, if I apply the following code:
string styleName = "newone";
pt.CustomTableStyleName = styleName;
PivotTableStyle pivotTableStyle = new PivotTableStyle(styleName);
PivotStyle pivotStyle = book.CreatePivotStyle();
pivotStyle.Fill.PatternColorObject.SetKnownColor(ExcelColors.Blue);

//apply the style where you need to add
pivotTableStyle.Styles.Add(PivotTableElement.thirdSubtotalRow, pivotStyle);
book.AddPivotTableStyle(pivotTableStyle);

I lose the applied style:
pt.BuiltInStyle = PivotBuiltInStyles.PivotStyleMedium6;
I want applied the background color in then style
thank you

ict@sogedin.it
 
Posts: 63
Joined: Mon Jul 15, 2013 2:06 pm

Wed Mar 10, 2021 10:02 am

Hello,

Thanks for your inquiry.
Do you want to directly modify the Backcolor of the PivotStyleMedium6 style? If so, please note that the code you are using above is creating a custom style (as shown below), so it will directly override the PivotStyleMedium6 style.
8901FE80-8B72-4a90-9CA2-E57C6377C364.png
8901FE80-8B72-4a90-9CA2-E57C6377C364.png (17.61 KiB) Viewed 301 times

Besides, sorry to tell you that the PivotStyleMedium6 style is a pre-defined style inside our product and cannot be modified. Hope you can understand.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Return to Spire.XLS