You can control some localization aspects of a workbook such as currency, dates as well as the number group and decimal separators, by passing a particular CultureInfo
type when creating or opening a workbook file in SpreadsheetGear. The Factory.GetWorkbook(...) and Factory.GetWorkbookSet(...) methods are overloaded to accept this CultureInfo
object. If you do not specify a CultureInfo
object, SpreadsheetGear defaults to "en-US".
My guess is that your workbook set is currently using "en-US" because you did not specify a Portugese CultureInfo
type. Below is an example that should demonstrate how to get your above NumberFormat
to appear as expected with SpreadsheetGear:
// Create a new workbook specifying "pt-BR" CultureInfo
IWorkbook workbook = Factory.GetWorkbook(CultureInfo.GetCultureInfo("pt-BR"));
IWorksheet worksheet = workbook.ActiveWorksheet;
IRange cells = worksheet.Cells;
cells["A1"].NumberFormat = "[=0]0;###.###,00";
cells["A1"].Value = 2265.65;
Console.WriteLine(cells["A1"].Text);
// Output: 2.265,65