Posted 21 March 2019, 5:28 pm EST
I’m using the Spread 12 and the new API to set a cell value and number format.
Example.
var wb = fpSpread1.AsWorkbook();
var range = wb.ActiveSheet.Cells[1,1];
range.Value = 1694.5452;
range.NumberFormat = "0.000";
On an English(US) system the cell is rendered like “1694.545”
On a Windows system (e.g. Indonesia locale) where the regional setting specify the decimal point is a comma (,) and the thousands separator is a period (.) the cell is rendered like “1.695”.
This kind of makes sense if the NumberFormat is interpreted using Indonesia locale (i.e. the period in 0.000 becomes a thousands separator rather than the decimal separator).
So, I tried setting the Number Format using the local abstraction of the format string, i.e. “0,000” hoping the comma would act as the decimal point. Unfortunately, the cell is still rendered like “1.695” (rather than the desired “1695.545”).
Two questions.
-
Are NumberFormats meant to be localized, or should they always be written in English US? (I’m sure when using the old-API GeneralCellType.FormatString you just used English US in the FormatString and the output would be rendered according to the system settings.)
-
How do I set the locale/culture/regional settings when using the new IWorkbook API?