Locale number format

hi,


i have problem with numbers format with .

if you are in eurupe you will write 1,50 but in US 1.50

in excel if you write number save the file and open the file after changing the regional settings the format will be changed automaticlly.

is it possible to do the same with aspose?

i need to write number with 1,000.50 and open it in US the same but in europe as 1.000,50

This message was posted using Page2Forum from Aspose.Cells for .NET - Documentation

Hi alshemesh,

You shouldn’t have any problem, just write the value with Aspose.Cells and change the regional settings and see the results. Let us know, if you have any problems.

hi,


i did it , but its not working.

if i am writing new value i see it changed, but the data that was exported dindnt change.

Hi alshemesh,

I investigated about your issue; you will just insert actual number and set their style with custom format “#,##0.00”. Here is a code example. Open it and change the regional settings to USA and then change it to Europe, you will see the number will change accordingly.

I have also attached the output xlsx file generated by this code.

C#


//Create a workbook

Workbook wb = new Workbook();


//Access a sheet

Worksheet ws = wb.Worksheets[0];


//Access a cell

Cell cel = ws.Cells[“A1”];


//Place a value

cel.PutValue(123456789.01);


//You need to set the style now

Style st = cel.GetStyle();

st.Custom = “#,##0.00”;

cel.SetStyle(st);


//Autofit first column

ws.AutoFitColumn(0);


//Save the output file

wb.Save(@“c:\downloads\test.out.xlsx”);



Hi,

Please also see this screenshot.