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

fix: zero number format bug #1703

Closed
wants to merge 1 commit into from
Closed

fix: zero number format bug #1703

wants to merge 1 commit into from

Conversation

@suntopo
Copy link
Contributor

@suntopo suntopo commented Dec 12, 2019

test demo in nodejs

var xlsx = require('node-xlsx');
var fs = require('fs');

const data = [[1, {t: 'n', f: 2, z: 2}, {t: 'n', f: 0, z: 2}]]

var buffer = xlsx.build([{name: "mySheetName", data: data}]); // Returns a buffer
fs.writeFileSync('test.xlsx', buffer)

before change

2019-12-12 17-52-03屏幕截图

after change

2019-12-12 17-53-03屏幕截图

@SheetJSDev SheetJSDev force-pushed the SheetJS:master branch from 0786b99 to 3b589f0 Aug 12, 2020
@SheetJSDev
Copy link
Contributor

@SheetJSDev SheetJSDev commented Sep 9, 2020

The issue here is that f should be a string, not a number:

const data = [[1, {t: 'n', f: "2", z: 2}, {t: 'n', f: "0", z: 2}]]

So it's preferable to check if it is a string

@SheetJSDev SheetJSDev closed this in 0cc6cc9 Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.