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

Free Support Forum - aspose.com

[Regression] Setting character font name corrupts Excel file with recent Aspose.Cells versions

Hi,

When setting font for individual characters in a cell, the Excel file gets corrupted with the recent versions of Aspose.Cells. It worked properly with older versions (e.g. Aspose.Cells 18.3.0).

Code:

var workbook = new Workbook(@".\test.xlsx");
var cellD5 = workbook.Worksheets[0].Cells[“D7”];
cellD5.Characters(0, 1).Font.Name = “DFKai-SB”;
cellD5.Characters(1, 1).Font.Name = “DFKai-SB”;
var cellB58 = workbook.Worksheets[0].Cells[“B58”];
cellB58.Characters(0, 1).Font.Name = “DFKai-SB”;
cellB58.Characters(1, 1).Font.Name = “DFKai-SB”;
workbook.Save(@".\out.xlsx"); // corrupted file in 21.11.0 but correct file in 18.3.0

Setting font for individual characters is a useful feature to have multiple fonts in one cell, and is also supported in MS Excel. With the recent versions, this seems to not always work. Also note that it seemed to only happen with cell D7 and B58, applying the same procedure on all other cells worked fine.

I’ve attached the test files and the font ‘DFKai-SB’ for your reference.

test.zip (2.8 MB)

Since it was working fine before there might be a regression. Could you help me check?

Thanks,

@ServerSide527,

Please try our latest fix/version: Aspose.Cells for .NET v21.11.8 (attached)
Aspose.Cells21.11.8 For .NetStandard20.Zip (5.6 MB)
Aspose.Cells21.11.8 For .Net4.0.Zip (5.6 MB)
Aspose.Cells21.11.8 For .NetStandard20.Zip (5.6 MB)

I have tested your scenario/case using your template file and sample code after installing your font, it works fine and the output file is not corrupted.

Let us know if you still find the issue using the latest fixed version.

Hi @Amjad_Sahi

I have tested with 21.11.8 and indeed it is working now. Thanks for the very quick update.

@ServerSide527,

It is nice to know that your issue is sorted out in the latest version/fix. In the event of further queries or issue, feel free to write us back.