Posted 30 June 2025, 12:59 am EST - Updated 30 June 2025, 1:04 am EST
I have previously discussed on the forum the issue of formatting numeric cells for non-English regional settings. Some fixes were made in Spread 12 and continued to work in Spread 13 (not sure beyond that). However Spread 18 seems to have broken all this. Previous post:
https://developer.mescius.com/forums/spread-winforms/how-to-set-the-culture-so-spread-works-on-non-english-windows-system
I am interested particularly in regions where the decimal point is a comma (“,”) and the thousands seperator is a period (“.”), such as Indonesia.
Fundamental of this was that IRange.NumberFormat accepted format strings in the culture of the system, and would display values using the culture of the system.
I wrote some code like this to display some formatted values on various systems
public void TestFormats()
{
IWorkbook workbook = fpSpread1.AsWorkbook();
IWorksheet worksheet = workbook.ActiveSheet;
var range = worksheet.Cells[3, 2];
range.Value = 1694.5452;
range.NumberFormat = "0.000";
range = worksheet.Cells[4, 2];
range.Value = 1694.5452;
range.NumberFormat = "0.00";
range = worksheet.Cells[5, 2];
range.Value = 1694.5452;
range.NumberFormat = "0.0";
range = worksheet.Cells[7, 2];
range.Value = 1694.5452;
range.NumberFormat = "0,000";
range = worksheet.Cells[8, 2];
range.Value = 1694.5452;
range.NumberFormat = "0,00";
range = worksheet.Cells[9, 2];
range.Value = 1694.5452;
range.NumberFormat = "0,0";
}
Here are the collated results showing the formatted cells from 3 different runs. I’ve attached this as a png: