Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue May 25, 2021 2:31 am

Hello,
Im having trouble with some values inside formules. I need it to display like English Number format.("." for decimal and "," for thousands)
I already have tried with Replace function but i can't use it because the cell has a formula inside with named ranges.
Is there any option that allow excel to set custom decimal or thousand separator?

Thanks

Leanlarroza
 
Posts: 4
Joined: Tue May 25, 2021 2:24 am

Tue May 25, 2021 8:24 am

Hello,

Thanks for your inquiry.
Please refer to the following code to meet your needs. If this is not you want, please provide us with your input file and the desired output for further investigation. Thanks in advance.
Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile("test.xlsx");
            Worksheet sheet = workbook.Worksheets[0];
            sheet.Range["A1"].NumberFormat = "#,##0.00";
            workbook.SaveToFile("sample.xlsx", ExcelVersion.Version2016);


Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue May 25, 2021 11:24 am

Hello,
I have already tried with NumberFormat property but it does not affect the cell.
I am currently using the Italian Culture because i need to print the same file twice (1 in Italian and 1 in English)
I have just sent the input excel file to your support email so you can verify.

Thank you so much

Leanlarroza
 
Posts: 4
Joined: Tue May 25, 2021 2:24 am

Wed May 26, 2021 10:44 am

Hello,

Thanks for your sharing via email.

Do you want to set the number format of cells to English Number format ("." for decimal and "," for thousands) in Italy Culture? Kindly note that the decimal symbol and thousands separator symbol is related to the Number formats of the region setting (as shown in the attached screenshot). And in Italy Culture, the default decimal symbol is “,” instead of “.”, and the default digital grouping symbol is “.”.

If you want to use English Number format ("." for decimal and "," for thousands), I’m afraid you need to change the default decimal symbol and digital grouping symbol in your system.
screenshot.png
screenshot.png (91.12 KiB) Viewed 1694 times


If there is any question or misunderstanding, please feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.XLS