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 - ability to format with defined width #2689

Open
eyal1990 opened this issue May 19, 2022 · 1 comment
Open

SSF - ability to format with defined width #2689

eyal1990 opened this issue May 19, 2022 · 1 comment

Comments

@eyal1990
Copy link

In order to replicate excel-like behavior it's not enough to format a number (for example), the format should also take into account the cell width and the cell font.
This way, a number with a large cell might be formatted into "99999999999". If it will havve less space or the font will be larger the formatted value will be "1.000E+11" and then"1E+11" when has even less space.

I would have liked to have the ability to write something like for a cell of size 100px, with the given font:
ssf.format("99999999999", "General", 100, "Calibri 13px");

Does SSF has the ability to do it? If not, do you have any suggestions how to do it or do you have a plan to offer this ability?

Thank you.

@SheetJSDev
Copy link
Contributor

Not currently, but there are definitely plans to support font-aware rendering as well as reflecting the colors.

Back in 2013 (wow time flies!) the goal was to convert from XLSX / XLS to CSV. Excel ignores column widths in the CSV export, instead performing "General" formatting with the full 11 digit logic.

A good test value is 543212345 since it rounds down:

W Text
9 543212345
8 5.43E+08
7 5.4E+08
6 5E+08
5 ####

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