Editing the pivot table filters changes cell format

Good day,

I hope you are well.

I am just posting with regards to an issue I am experiencing when creating a pivot table with a certain cell format. The issue occurs when I change the filter of the pivot table, or make any edit to the pivot table (such as expanding column fields or changing the sort direction). It seems to undo the formatting that was previously applied to the heading cells. My code and screenshots are below. 


As you can see, formatting is applied correctly at the start:


Then I change sort direction as below:



Finally, you can see the font size changes from 8 to 11 below:


Please let me know if there is any fix for this problem. 


Many thanks in advance,

Matthew



Code: 

using (ExcelEngine excelEngine = new ExcelEngine())

            {

                IApplication application = excelEngine.Excel;

                application.DefaultVersion = ExcelVersion.Excel2016;

                IWorkbook workbook = application.Workbooks.Create(2);

                IWorksheet dataSheet = workbook.Worksheets[1];

                dataSheet.Name = "Data";


                dataSheet.ImportData(data, 1, 1, true);

                IWorksheet pivotSheet = workbook.Worksheets[0];


                pivotSheet.Name = "PivotSheet";

                IPivotCache pivotCache = workbook.PivotCaches.Add(dataSheet.Range);


                IPivotTable pivotTable = pivotSheet.PivotTables.Add("PivotTable1", pivotSheet["A1"], pivotCache);

                pivotTable.BuiltInStyle = PivotBuiltInStyles.PivotStyleMedium15;


                IPivotField pivotFieldRow = pivotTable.Fields["Description"];

                pivotFieldRow.Axis = PivotAxisTypes.Row;


                pivotFieldRow.AutoSort(PivotFieldSortType.Ascending, 1);


                pivotFieldRow.Name = "Description";

                IPivotField pivotFieldColumn = pivotTable.Fields["Period"];


                pivotFieldColumn.Axis = PivotAxisTypes.Column;

                pivotFieldColumn.AutoSort(PivotFieldSortType.Ascending, 0);

                pivotFieldColumn.Name = "Period";

                IPivotField pivotField = pivotTable.Fields["InclusiveAmount"];

                pivotTable.DataFields.Add(pivotField, "Values", PivotSubtotalTypes.Sum);

                pivotTable.DataFields[0].NumberFormat = "# ##0.00";

                PivotTableImpl pivotTableImpl = pivotTable as PivotTableImpl;


                pivotTable.Layout();

                pivotTableImpl.Cache.IsRefreshOnLoad = true;

                pivotTable.ColumnGrand = false;

                pivotTable.RowGrand = false;


                var columnCount = pivotTable.Location.LastColumn - 1;

                var rowCount = pivotTable.Location.LastRow;


                var bottomRightCell = ((char)(columnCount + 64)).ToString() + rowCount;


                var formatStr = string.Format("A1:{0}", bottomRightCell);


                IPivotCellFormat pivotCellFormat = pivotTable.GetCellFormat(formatStr);

                pivotCellFormat.FontName = "Calibri";

                pivotCellFormat.FontSize = 8;


                Stream stream = new FileStream("pivotTable.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);

                workbook.SaveAs(stream, ExcelSaveType.SaveAsXLS);

                workbook.Close();

                excelEngine.Dispose();

                stream.Close();

            }


10 Replies 1 reply marked as answer

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 11, 2022 12:02 PM UTC

Hi Matthew, 

Greetings from Syncfusion. 

We are checking the query and will get back to you with details tomorrow (January 12th,2022). 

Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 12, 2022 01:35 PM UTC

Hi Matthew, 

We appreciate your patience. 

We are able to reproduce the reported issue at our end and validating it currently. We will share the validation details in 2 business days, on January 17th,2022. 

Regards, 
Keerthi. 



MC Matthew Coombe January 17, 2022 01:29 PM UTC

Good day Keerthi,


Thank you for looking into it. I eagerly await your response.


Regards,

Matthew



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 17, 2022 01:50 PM UTC

Hi Matthew, 
  
We appreciate your patience. 
  
We have confirmed the issue as Pivot field font size is wrong while changing the sorting order in MS-Excel and logged a defect report. We will include the fix for this issue in our weekly NuGet release scheduled for February 1st,2022. 
  
You can track the status of defect report through following feedback link. 
Regards, 
Ramya. 



MC Matthew Coombe January 17, 2022 01:57 PM UTC

Hi Ramya,


Thank you once again for the excellent customer support.


Regards,

Matthew



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 18, 2022 05:36 AM UTC

Hi Matthew, 

You are welcome and thanks for your appreciation. 

Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team February 2, 2022 12:55 PM UTC

Hi Matthew,  
  
We regret for the inconvenience.  

Weekly NuGet release scheduled for February 1, 2022 has been called off due to 2021 Vol4 SP release. Hence, we will include the fix in our next weekly NuGet release, scheduled for February 8, 2022 and will let you know once the package is available to download from nuget.org.
  

We appreciate your patience.
  
  
Regards,
Keerthi.
 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team February 8, 2022 12:19 PM UTC

Hi Matthew, 

We appreciate your patience. 

We have included the fix to resolve the issue Pivot field font size is wrong while changing the sorting order in MS-Excel in our weekly NuGet release version 19.4.0.50. Kindly upgrade your Syncfusion packages to this new 19.4.0.50 version and let us know if the issue is resolved. 

Regards, 
Ramya. 


Marked as answer

MC Matthew Coombe February 8, 2022 03:16 PM UTC

Hi Ramya,


The issue seems to be resolved and everything is working correctly on my end. Thank you for the assistance and great communication. It is much appreciated.


Many thanks,

Matthew



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team February 8, 2022 04:08 PM UTC

Hi Matthew, 

We are glad that the issue is resolved at your end. Kindly let us know if you need any further assistance. 

Regards, 
Keerthi. 


Loader.
Up arrow icon