This project is read-only.

Problem with decimal values in formula's in Dutch culture

Feb 19, 2010 at 3:36 PM


This issue is related to the fact that in the Dutch culture, the comma (",") is the decimal separator (rather than point). When I want to use a constant decimal value in a formula (e.g. SetCellFormula("1,02+5")), an error is thrown from the SetCellFormula method, because the comma is interpreted as a special character in formula's (while for Excel in Dutch culture it is completely valid, where semicolon is used as parameter separator for excel functions). When I try to use point as decimal separator, all decimal signs are ignored (=> values * 100). I could of course add "/ 100" to my formula but I'm looking for something else I guess (like a setting to avoid formula parsing from the component or a setting to change the working culture).

Can anyone help me here please?


Mar 1, 2010 at 1:33 AM

It looks to be a new bug not only for NPOI but also for POI. Currently, I don't have solution for it. The only available workaround is to use dot instead of comma.

Sep 14, 2010 at 5:08 AM

Dim ci As Globalization.CultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = Globalization.CultureInfo.CreateSpecificCulture("en-US")
c.CellFormula = CStr(value).Remove(0, 1).Replace(",", ".") 'remove equal sign...
System.Threading.Thread.CurrentThread.CurrentCulture = ci