Format Number issues while saving to PDF

When saving an xlsx document, where a numeric type cell contains a value like the following:


When saving this document in PDF format, the thousands groupers and the decimal separator are changed, example:


If I save the xlsx in its original format, if it preserves the values properly.

Code to save the PDF:

Workbook _document = CreateDocument();
var memoryDocument = new MemoryStream();
_document.Save(memoryDocument, new PdfSaveOptions());

attachment file in xlsx
a6.7z (17.3 KB)

Output in pdf
output.pdf (51.1 KB)

Cell: C12 (it is numeric type​)
D12 (it is of generic type, with this format you do not have the problem​)

I’m using the Aspose.Cell nuget with the version 20.3.0 and .Net framework 4.6.1



I have evaluated and tested your issue using your template file. I opened your Excel file into MS Excel manually and found your output PDF file is matched with input Excel file for C12 and D12 cells. So, I could not find any issue. See the attached screenshot, I compared the input Excel file (when viewed in MS Excel) and output PDF file (in Adobe acrobat) by Aspose.Cells and did not find any issue or difference.
sc_shot1.png (96.0 KB)

Attached images of how we see it:

Error.JPG (109.0 KB)

ConfigurationFormatCell-C12.JPG (55.8 KB)

Perhaps the difference is the configuration of the windows number formats.

ConfigurationRegional.JPG (32.1 KB)
ConfigurationRegionalCurrency.JPG (21.8 KB)

Please leave the “,” (comma) as Decimal Symbol
Y “.” (dot) as Digit grouping symbol.

Perhaps it is related to the format region, the error was identified with English (Unite States) and German.

ErrorGif.7z (6.6 MB)

If I perform the manual operation in excel I don’t see the error, it only happens when I export with aspose to PDF.

Error2-ManualProcess.gif (1.7 MB)



Thanks for providing further details and screenshots.

I evaluated your issue further. You need to specify region or locale settings in code, so the formatted numbers should be rendered accordingly. Please see the following sample code that works fine and as expected as I tested:
Sample code:

LoadOptions options = new LoadOptions();
options.Region = CountryCode.Germany;
Workbook _document = new Workbook("e:\\test2\\a6.xlsx", options);
_document.Save("e:\\test2\\out1.pdf", new PdfSaveOptions());

Let us know if you still have any issue.

Hi @Amjad_Sahi, thanks for responding in a timely manner, I did a test and it didn’t work, in the same way the regional configuration of the operating system can specify different regions for a single country, and the “CountryCode” enumeration does not consider that.

Error3.7z (6.4 MB)

EnumCountryCodeVsRegionsFormatWindows.png (59.5 KB)

EDIT: I realize that the document, cultural information format properties are wrong, but I can’t explain why saving the Excel in its original format is correct.

DiferentCultureInfo.png (52.9 KB)


Could you elaborate the issue or differences with the output PDF when using my sample code, I could not spot it. Also, if you want “.” as group separator and “,” as decimal separator, you should set some region/locale (e.g. Germany) which has such settings. Also, could you provide your expected PDF file. We will check it further.

@Amjad_Sahi Thanks.

I used the supplied code and the error persists, however I have discovered why it occurs in my project.

The property “Workbook.Settings.CultureInfo” is not updated with what I have configured in the operating system.

If I change override the document’s CultureInfo the PDF output is correct.

                     Workbook _document2 = new Workbook("\\test\a6.xlsx");
                    var newCulture = CultureInfo.CreateSpecificCulture("en-US");
                    newCulture.NumberFormat.NumberDecimalSeparator = ",";
                    newCulture.NumberFormat.NumberGroupSeparator = ".";
                    _document2.Settings.CultureInfo = newCulture;   

The weirdest!!!
I created the same project in .Net framework 4.6.1 and Aspose.Cells with the same characteristics in both projects, and the result is different, in the new project the error is not replicated with the same code, with the same input.

Differentbehavior_twoProjects_with_same_code.7z (8.7 MB)

ExpectedOutPut.pdf (51.1 KB)

Aspose.Cells.dll.7z (3.4 MB)

Edit: this issue is similar to

I appreciate if you can continue helpme on how I could solve this error


Since you are using an older version of Aspose.Cells for .NET, so we cannot evaluate your issue using the older version that you are using. We recommend you to kindly try using our latest version/fix (Aspose.Cells for .NET v22.1) and let us know with sample project (using latest version) if you still find the issue.