protobi / js-xlsx

XLSX / XLSM / XLSB (Excel 2007+ Spreadsheet) / ODS parser and writer
http://oss.sheetjs.com/js-xlsx
Other
814 stars 416 forks source link

styles not saved #139

Open Xenorage opened 4 years ago

Xenorage commented 4 years ago

Saving styles are not supported or is this a bug? var buf = fs.readFileSync("tes2.xls"); // console.log("input", input); const wb = XLSX.read(buf, { type: "buffer", cellText: false, cellDates: true, cellStyles: true }); wb.Sheets[wb.SheetNames[1]]['D5'].s= { patternType: 'solid', fgColor: { rgb: '969696' }, bgColor: { rgb: '000000' } }; XLSX.writeFile(wb,"tes3.xls", {cellStyles:true});

RimaCiklum commented 3 years ago

If I understand your issue correctly, the following code might be helpful: wb.Sheets[wb.SheetNames[1]]['D5'].s = { "fill": { "fgColor": { "rgb": "969696" }, "bgColor": { "rgb": '000000' } } };