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

Free Support Forum - aspose.com

Number formatting issue converting excel to pdf

Hi Team,

i am using licensed version of aspose.cells to convert excel to pdf.
for german user it was giving issue so i used the below code.
myWorkBook.Workbook.Settings.Region = Aspose.Cells.CountryCode.Germany

using this number is getting formatted as expected but dates are also getting changed.
i dont want the date format to be changed.

in my system i have date and number settings for every user.
is there any way by which we can supply the date and number formatting to use instead of region while converting excel to pdf.

means i want to use date format as dd\mm\yyyy and number format as 12.345,56


Well, I am afraid, when you set the locale/region settings, it will print all the numbers and date time values according to your locale settings, we cannot be specific to render numbers and ignore dates.

Thanks for your understanding!

how do i change the setting.cultureinfo.numberformat?

i can supply this before saving as pdf right?

How can i use settings.cultureinfo.numberformat.numberdecimalseparator to supply “,” as decimal separator.


Could you try CultureCustom and Custom attributes of Style object to set your desired formatting your specific cells before rendering to PDF if it makes any difference.

Style style = cell.GetStyle();
style.Custom = “dd/mm/yyyy;@”;
style.CultureCustom = "“dd/mm/yyyy;@”;
//Applying the style to the cell

Thank you.

I will try but i want to do the workbook level settings.

i cannot parse through each column and set the style.


Thanks for your posting and using Aspose.Cells.

We are afraid, there is no way to just change the number formats. If you will change the locale of the thread, it will affect whole application settings of dates and number formats.

then how to use Settings.CultureInfo.NumberFormat.CurrencyDecimalSeparator = “.”?

PS :this is very urgent for me.

please reply me as this is urgent for me.


Please use codes like:
CultureInfo ci = new CultureInfo(“de-DE”);
ci.NumberFormat.NumberDecimalSeparator = “.”;
ci.NumberFormat.NumberGroupSeparator = “,”;
wb.Settings.CultureInfo = ci;

I am using same code only for .net with latest aspose.cells but its giving me exception as Instance is read only.

see attached file.


Please create a new CultureInfo like the edited code in my prior reply, then you can change the separators. Also, please set different CultureInfo from current cultureinfo used by the workbooksettings so that the code of “Settings.CultureInfo = …” can take effect.

Thanks for the code.

when i use “de-DE” then i can switch the decimal separator from . to , but with this when i use date format as dd\mmmm\yyyy it starts translating that too.
so i tried to use en-US to switch the decimal seperator from . to , but its not working.

Below is my code

Dim ci As New System.Globalization.CultureInfo(“en-US”, True)
ci.NumberFormat.NumberDecimalSeparator = “,”
ci.NumberFormat.CurrencyDecimalSeparator = “,”
ci.NumberFormat.CurrencyGroupSeparator = “.”
ci.NumberFormat.NumberGroupSeparator = “.”

myCombineExcel.Settings.CultureInfo = ci


Thanks for your posting and using Aspose.Cells.

We think your default locale is en-US too. For performance consideration, we do not rebuild number formattings when we found that the new CultureInfo is equal to the one being used by workbooksettings currently. So, as we have said in previous post:

"please set different CultureInfo from current cultureinfo used by the workbooksettings so that the code of “Settings.CultureInfo = …” can take effect."

you have to make the locale different from the current one of workbooksettings.

However, for user’s convenience, we will change the logic from next fix to rebuild number formattings always when “Settings.CultureInfo = …” be called so that the new assigned cultureinfo can take effect always.

Before we provide the new fix, please use code like:

myWorkBook.Workbook.Settings.Region = Aspose.Cells.CountryCode.Germany
Dim ci As New System.Globalization.CultureInfo(“en-US”, True);

myCombineExcel.Settings.CultureInfo = ci

Thank you.

Thanks this worked.

but please fix this issue from your side as my product is getting used for all countries.
please provide me CELNET number for this issue;


Thanks for your posting and using Aspose.Cells for .NET.

We have logged your issue in our database. We will look into this issue further and provide you a fix for it. This issue has been logged as CELLSNET-41486.


Thanks for your posting and using Aspose.Cells for .NET.

Please download and try this fix: Aspose.Cells for .NET v7.4.1.3.

For this issue about setting CultureInfo for WorkbookSettings, please try the new fix(Aspose.Cells for .Net V7.4.1.3). Now number formattings
will be rebuilt always when user calls WorkbookSettings.CultureInfo = …;

The issues you have found earlier (filed as CELLSNET-41486) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.