Open yuanoook opened 3 years ago
The use case is like this:
To customize the cell to use the other numFmt, like currency "$"#,##0.00;[Red]\-"$"#,##0.00, or even more;
"$"#,##0.00;[Red]\-"$"#,##0.00
Set _value: 10000, instead of _value: "10000".
The string _value: "10000" could not be recognized as a calculation dependency in excel software, which bugged our clients a lot.
To use data-base64-xlsx-cell-config
data-base64-xlsx-cell-config
const htmlTo = require('html2xlsx') const btoa = (window && window.btoa) || (str => Buffer.from(str, 'utf-8').toString('base64')) htmlTo(` <table> <tr> <td data-base64-xlsx-cell-config="${btoa(JSON.stringify({ numFmt: '"$"#,##0.00;[Red]\-"$"#,##0.00', cellType: 'TypeNumeric', _value: 10000 }))}" > 10000 </td> </tr> </table> `, (err, file) => { if (err) return console.error(err); file.saveAs() .pipe(fs.createWriteStream('test.xlsx')) .on('finish', () => console.log('Done.')); });
Coverage remained the same at 100.0% when pulling e48f9b76a562ff053ea2486ef66193f38953be69 on yuanoook:cell-customization-enhancement into e104d08828e6b27a40f761193742ce71d859fbef on d-band:master.
Another issue found: NODE_ENV is not a command when try to install 0.4.2 in windows
This could be solved with cross-env, or, run build in prepublish as 0.4.0.
The use case is like this:
To customize the cell to use the other numFmt, like currency
"$"#,##0.00;[Red]\-"$"#,##0.00
, or even more;Set _value: 10000, instead of _value: "10000".
The string _value: "10000" could not be recognized as a calculation dependency in excel software, which bugged our clients a lot.
To use
data-base64-xlsx-cell-config