-
Hi! Is there a way to set the locale for the html writer? After loaded the file and put to webpage: These settings not helped at all: Do I have to loop through all the cells and set proper formatting? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
The |
Beta Was this translation helpful? Give feedback.
-
There is an You can retrieve the formatting mask for a cell using: $cell->getStyle()->getNumberFormat()->getFormatCode(); which returns the formatting mask as a string (exactly the values used in MS Excel). And you could use that value to identify if the cell was formatted as a Currency/Accounting value. An alternative might be to use the Cell's |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
That depends on the exact mask format being used; as with Dates/Times, some of the built-in Accounting and Currency formats in MS Excel are locale-aware. PhpSpreadsheet is not locale-aware, so cannot directly replicate this behaviour, but it does make a check against the locale-settings of the server that it is running on. |
Beta Was this translation helpful? Give feedback.
The
Settings
locale is used for the calculation engine language, but there is no explicit locale setting for currency or date formatting in PhpSpreadsheet. None of the date/currency formatting is locale-aware; and has to be set manually; so you would need to set it for all cells that needed it, but you can set styles (including number formatting) for a range of cells (e.g.A2:A120
), or a row/column range (e.g.2:5
orA:B
).