Lost cell formats after saving xls with Pivot

Hello,

Source excel file (Office 2003) has Worksheet with Pivot containing formated cells (some rows have integers, some decimals, and some percenteges).

After opening excel with Aspose.Cells, filling datasource for Pivot, executing CalculateData() on Pivot, and saving file, all formats are lost when I open that file later in Excel (all are set to “General”).

Is there a bug or something not resolved yet?

I’am using latest relese 5.3.3

Thanks,

Ivan

Hi Ivan,


Attached to reply is latest fix version of Aspose.Cells for .NET v5.3.3.2. Please give it a try and if you still face difficulties then it would be of great help that you provide us a simple console application along with your input Excel file that can re-produce the said issue on our end. We will look into it real soon.

Thank you

Hi,

Problem is still there and I attached sample excel I used. Saved file does not contain formated cells in Pivot. Code to reproduce is simple:

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(“PivotTest.xls”);

wb.Worksheets[0].Cells[“B2”].Value = 1;
wb.Worksheets[0].Cells[“B3”].Value = 2;
wb.Worksheets[0].Cells[“C2”].Value = 3.45;
wb.Worksheets[0].Cells[“C3”].Value = 6.78;
wb.CalculateFormula();

Aspose.Cells.Pivot.PivotTable pt = wb.Worksheets[1].PivotTables[0];
pt.CalculateData();

wb.Save(“PivotTest_out.xls”);

Thanks,

Ivan

Hi Ivan,


I didn’t find any issue in output file.

In Input file formatting is applied to B2, B3, C2, C3, F2, F3, G2 and G3 Cells of sheet “POKAZATELJI”. This formatting remains intact in output file.

Regarding Pivot, the number format for data fields is set to General in input as well as output file. Output file is attached for your reference.

Please do let me know, if I am missing something here.

Hi,

After testing your case, I have found the issue you talked about. After using your sample code with your template file, the output file has lost the formatting
(regarding Numbers) in the second sheet i.e. “Pivot”. I can find that right-clicking on the cells e.g “B3”, “C3” etc. and clicking the “Format Cells…”, it has been set to “General” instead of “Number”. I have logged an issue with an id:
CELLSNET-27993. We will look into your issue soon.

Thank you.

Hi,

The number format is not set to General in input. I’m sending you screenshots of input I sent you and output you sent to me. As you can see, not only that number formats are not preserved but Font Type and Column width also.

I opened files in MS Excel 2003 and 2007. Both with same result.

I hope that you will resolve this issue.

Best regards,

Ivan


Hi Ivan,

Thanks for the sample screen shots.

I have already found and logged your issue with an id: CELLSNET-27993. We will figure it out soon.

Thank you.

Hi,

We have fixed this issue. Please download: Aspose.Cells for .NET v5.3.3.3.

Hi Shakeel!

Thanks a lot. It’s working now. Great job for you and your team :slight_smile:

Ivan