We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

After saving workbook and opening it in Excel cells are not showing correct font names when selected

Hi,

We have an issue, when opening and saving a Excel file in Aspose.Cells the name of the fonts used in cells are not correct, they all seem to be set to Calibri (please see the attached screenshots taken before and after saving with Aspose.Cells).
We investigated and after saving Aspose.Cells is reporting (internally) correct fonts on the cells, the problem is when opening that file in Excel and all the cells are shown as having font set to Calibri.
For reproducing the issue please use the attached Excel file and the following code:

var loadedWorkBook = new Workbook(“41499.xlsx”);
var loadedWorksheet = loadedWorkBook.Worksheets[“Sheet1”];
var loadedCells = loadedWorksheet.Cells;

Console.WriteLine(“Font for cell B5: {0}”, loadedCells[“B5”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell C5: {0}”, loadedCells[“C5”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell B6: {0}”, loadedCells[“B6”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell C6: {0}”, loadedCells[“C6”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell B7: {0}”, loadedCells[“B7”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell C7: {0}”, loadedCells[“C7”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell B8: {0}”, loadedCells[“B8”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell C8: {0}”, loadedCells[“C8”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell B9: {0}”, loadedCells[“B9”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell C9: {0}”, loadedCells[“C9”].GetStyle().Font.Name);

loadedWorkBook.Save(“41499-Saved.xlsx”);

var savedWorkBook = new Workbook(“41499-Saved.xlsx”);
var savedWorksheet = savedWorkBook.Worksheets[“Sheet1”];
var savedCells = savedWorksheet.Cells;

Console.WriteLine(“Font for cell B5: {0}”, savedCells[“B5”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell C5: {0}”, savedCells[“C5”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell B6: {0}”, savedCells[“B6”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell C6: {0}”, savedCells[“C6”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell B7: {0}”, loadedCells[“B7”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell C7: {0}”, savedCells[“C7”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell B8: {0}”, savedCells[“B8”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell C8: {0}”, savedCells[“C8”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell B9: {0}”, savedCells[“B9”].GetStyle().Font.Name);
Console.WriteLine(“Font for cell C9: {0}”, savedCells[“C9”].GetStyle().Font.Name);
Console.WriteLine(“Fonts seems to be correct in the new file.”);


Now please open “41499-Saved.xlsx” in Excel and check the font on the cells, all of them are set on Calibri.

InternalId: 41499

Best Regards,
Aurelian Iordache
Software Developer
IBM Romania

Hi Aurelian,


Thank you for contacting Aspose support.

We have evaluated the presented scenario while using the latest revision of Aspose.Cells for .NET 8.7.0.3 (attached) and we are not able to observe the said issue, that is; the font settings remain intact after re-saving the spreadsheet. Please check the attached snapshot as well as resultant spreadsheet for your reference. Please also give the latest revision a try on your end to feed us back with your results.

Hi Babar,

I confirm the issue is resolved in v.8.7.0.3 and for reference I’m attaching the resulted file where everything is okay. We are currently using v.8.7.0.0.
Thank you, please mark this issue as resolved or close it at your convenience.

Best regards,
Aurelian Iordache
Software Developer
IBM Romania

Hi Aurelian,


Thank you for the confirmation. It is good to know that you are up & running again. Please feel free to contact us back in case you need our further assistance with Aspose APIs.