Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSF - format not supported #2695

Open
alonkh2 opened this issue May 25, 2022 · 4 comments
Open

SSF - format not supported #2695

alonkh2 opened this issue May 25, 2022 · 4 comments

Comments

@alonkh2
Copy link
Contributor

alonkh2 commented May 25, 2022

I have been using SSF in my project, and have run into this problem - when the format is "#,0" it seems to throw an error. That is a valid excel format.

image

Error: unsupported format |#,0|
Component: write_num_flt
Stack: at write_num_flt (ssf.js:498)
at write_num (ssf.js:616)
at eval_fmt (ssf.js:824)
at format (ssf.js:940)

@SheetJSDev
Copy link
Contributor

Excel appears to be auto-correcting #,0 to #,##0. You can create a new file with

var wb = XLSX.utils.book_new();
var ws = XLSX.utils.aoa_to_sheet([[12345.6789]]);
ws["A1"].z = "#,0";
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
XLSX.writeFile(wb, "issue2695.xlsx");

(https://jsfiddle.net/c91Lotas/ live example) Excel 2019 en-US appears to treat it as number with thousands separator and zero decimal places

@alonkh2
Copy link
Contributor Author

alonkh2 commented May 26, 2022

I can see that, but is the library going to support that?

@SheetJSDev
Copy link
Contributor

It's an interesting question. The current approach is to stick the autocorrected formats in the main file processing library, but it probably should be added to the library.

@alonkh2
Copy link
Contributor Author

alonkh2 commented Jun 12, 2022

could you refer me to the code relating to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants