Free Support Forum -

Converting Excel to PDF with Custom Number format including Unicode using Aspose.Cells for .NET in C#

I’ve got a document with custom number formats on several cells. The number format contains Unicode characters that do not exist in the font I am using for the cells. Namely, superscript 4 through 9.

When I convert to pdf using Microsoft Excel, it keeps my font for characters that it can and uses Cambria for the other Unicode characters.

When I convert to pdf using Aspose.Cells, it changes the font for the entire cell to Calibri.

I’ve attached a sample document and output from Excel and Aspose.

This cell font change is making my documents look inconsistent. Can Aspose.Cells be changed to match the behavior of Microsoft Excel? Thanks!


Thanks for your posting and using Aspose.Cells.

I have checked your Microsoft Excel and Aspose.Cells generated PDF and was unable to observe any considerable difference. Could you please highlight the differences in some screenshots? It will help us identity the issue and fix it accordingly.

Please also download and try the latest version: Aspose.Cells for .NET (Latest Version) and see if it makes any difference in resolving your issue. Let us know your feedback.

I’ve tested using Aspose.Cells and the bug still exists.

The difference at this font size is indeed subtle. I’ve attached blown up views to make it more obvious. The first 3 entries (superscript 1,2 & 3) are correct in the Aspose output. It’s just the superscripts 4 through 9 that are bugged. Look at the difference in the “123” in the cell and you should see it.


Thanks for the screen shots.

Well, We noticed the behavior as you talked about but it is by design in Aspose.Cells.
Please note if the required font is not available then the API will try to use the Calibri font instead. So, it is correct behavior and we might not change it as our hundreds of users are already using the conversion feature and they accept this way.

The best way to cope with it is kindly install the underlying fonts, so the API could pick the relevant/ correct fonts for Excel to PDF rendering.

Thank you.

Look again at my sample xlsx and images. The cell font is set to Garamond.

The first 3 superscripts are rendering correctly. The characters for super script 1,2 & 3 exist in the Garamond font. This font is installed and working correctly in every cell except cells with Unicode superscript characters that don’t exist in Garamond.

The superscript characters for 4 through 9 do not exist in Garamond.

Excel will output the “1.23%” in Garamond and the superscript “4” in Cambria.

Aspose will output the entire “1.23%4” in Calibri.

I understand not wanting to change your fallback font to Cambria, and that is totally fine. But could the Aspose output match the Excel output where the “1.23%” is in Garamond and the missing “4” superscript character is rendered in Calibri?


Thanks for your explanation and using Aspose.Cells.

How can I find the font of the superscript in Microsoft Excel, because when I double click the cell, the superscript gets lost. Could you please provide some screenshots illustrating the steps to know the font of the superscript. It will help us investigate this issue more thoroughly.

I have also attached the screenshot explaining my issue for your reference.

There are custom formats applied to these cells that adds the superscript characters.

The custom format doesn’t have a font applied but rather is just a set of characters to be displayed. When Excel applies the formatting, if a character to be displayed doesn’t exist in the selected font for the cell, it will use Cambria for the missing characters.

For your reference, here are the different formats:











Thanks for your explanation and using Aspose.Cells.

We have logged this issue in our database as improvement ticket to implement/fix this issue. We will look into it and try to work same as like Microsoft Excel. Once, there is some fix or other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-43899 - Converting to PDF with Custom Number format including Unicode


Thanks for using Aspose.Cells.

Please use the following code and it will fix your issue. Let us know your feedback.

Workbook wb = new Workbook(srcFile);

PdfSaveOptions opts = new PdfSaveOptions();

opts.IsFontSubstitutionCharGranularity = true;

wb.Save(“outFile.pdf”, opts);

That works, thanks!

I wonder why it isn’t the default behavior considering that is what Excel does?


Thanks for your feedback and using Aspose.Cells.

It is not a default behavior because of performance reason. Please check this documentation article for your reference.