Converts Wrong Date and Currency Format from Excel to PDF Conversion by using “Aspose.Cells.dll”

Hi Team,

  1. When I convert a document from Excel to PDF by using “Aspose.Cells.dll” and version 20.12.0.0 in C# coding, the original date and currency formats from the excel document are changed to different format.

  2. I have uploaded a document “Issues with Aspose Library.docx” which contains the step-by-step process to reproduce the issue and this document contains the original document which I have used.

Issues with Aspose Library.docx (338.9 KB)

@rpostdev,

Thanks for the document.

We need your input Excel file, output PDF by Aspose.Cells APIs and your expected PDF file (you may create your expected PDF file via MS Excel) to evaluate your issue. Please do the needful and zip the files to attach the archive. We will check your issue soon.

@rpostdev,
We have tested your template file with both 20.12 and our latest version 22.9 and cannot find the issue. Please see the generated pdf: res20.12.pdf (90.2 KB). We can get the same result with it when we changing our regional settings of our pc to English(German) or using code below:
Workbook wb = new Workbook(“test.xlsx”);
wb.Settings.CultureInfo = new CultureInfo(“en_DE”);
wb.Save(“res20.12.pdf”);

Please confirm you are using the machine with same regional settings to generate your pdf file if you have not specified the cultureinfo for the workbook.

Also you may try above code we provided.

If you still cannot get the expected result, please try below code:
Console.WriteLine(DateTime.Now.ToString(new CultureInfo(“en_DE”)));
double dv = 12345.67891;
Console.WriteLine(dv.ToString("#,###.###", new CultureInfo(“en_DE”)));
and check whether the outputs are in correct formatting.

@Amjad_Sahi
I have provided the original document as part of the given word document.
Here, I attached the .zip folder which contains the original excel document, converted pdf document, and the expected output pdf.
Testlauf Rsign Umwandlung Formate (3).zip (217.9 KB)

@johnson.shi
Thanks for your response.

I am using the machine with same regional settings (i.e. English(Germany)) to generate the PDF and still able to reproduce the issue.
However, I was not using the “new CultureInfo(“en_DE”)” for the Workbook.

As you suggested, I have specified the cultureinfo for the workbook and it works as expected. But the problem is, we cannot specify cultureinfo for the workbook in the actual coding, as we do not know the user’s system culture info.

@rpostdev,

Thanks for the template file and PDF documents.

I checked your Excel file by opening the file into MS Excel manually but I could not evaluate formatting applied to certain cells (e.g., D8, K45, D45, etc.) as the worksheet is protected with a password. Could you please share password to unprotect the sheet, so I could evaluate the formattings applied to certain cells.

@Amjad_Sahi

The given work sheet is not password protected and you should able to open and update it directly.

@rpostdev,
If you did not specify the cultureinfo for Workbook, the environment’s cultureinfo settings of your application will be used. Because you can get the correct output with specified cultureinfo en_DE, we doubt that the default cultureinfo got in your application is not this one. So, please check what you can get by CultureInfo.CurrentCulture in your application, also you may output Workbook.Settings.CultureInfo before your saving it to see whether the cultureinfo is the correct one.

@johnson.shi

I have checked my application culture info and it is en-us.
However, in my case I do not want to use my application culture info.
I want to use client’s machine culture info and based on that conversion should happen. In this case, I am not able to get the client’s machine culture info in all scenarios.
Is there a way that we can handle this scenario?

@rpostdev,

It seems that you have client-server application model for your scenario/case. Since Aspose.Cells APIs are server based, so you need to specify culture info in code for your specific clients for their environments accordingly.

@Amjad_Sahi @johnson.shi
Thanks for your support and information on this issue.
We will further investigate on this issue from our end based on the information provided by you.

@rpostdev,

You are welcome. Sure, please take your time to evaluate it as per your requirements.