SheetJS / ssf

:memo: Spreadsheet Number Formatter

Home Page:http://oss.sheetjs.com/ssf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support formatting mask having more than 4 sections

hy9be opened this issue · comments

commented

Hi I tried the formatting string below

[>=1000000000]#,#0.0,,,"B";[>=1000000]#,##0.0,,"M";[>=1000]#,##0.0,"K";0.0;[<=-1000000000](0.0,,,"B");[<=-1000000](0.0,,"M");[<=-1000](0.0,"K");[<0](£0.0)

and got an error from the code here: https://github.com/SheetJS/ssf/blob/master/ssf.js#L808

Is there any specific reasons that you throw an exception when the number of fmt sections are more than 4? Thanks!

@hy9be In theory, it's because of the ECMA-376 spec (section 18.8.31 numFmts):

Up to four sections of format codes can be specified.

In practice, Excel 2016 does not accept the number format.

commented

@SheetJSDev Thanks a lot!