Skip to content

fix: zero number format bug#1703

Closed
ghost wants to merge 1 commit into
masterfrom
unknown repository
Closed

fix: zero number format bug#1703
ghost wants to merge 1 commit into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Dec 12, 2019

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant