gitbrent / xlsx-js-style

SheetJS Community Edition + Basic Cell Styles
https://gitbrent.github.io/xlsx-js-style/
Apache License 2.0
349 stars 56 forks source link

xlsx.read cellStyles: true not working #18

Open huan415201 opened 1 year ago

huan415201 commented 1 year ago

I read a template file with styles but using cellStyles: true is not working, below is my code:

const exportReportCardExcel = async (data) => {
    const binaryString = await readFile(ExportReportCardTemplate);
    const workbook = xlsx.read(binaryString, {
      type: "binary",
      cellStyles: true,
    });
    xlsx.writeFile(workbook, `file_xxx.xlsx`);
}

const readFile = (file) => {
  return new Promise((resolve, reject) => {
    const reader = new FileReader();
    reader.onload = (e) => {
      resolve(e.target.result);
    };
    reader.onerror = (e) => {
      reject(e);
    };
    fetch(file)
      .then((response) => response.blob())
      .then((file) => reader.readAsBinaryString(file));
  });
};

Here is the template:

image

And here is the new exported file:

image

ZhenjaMax commented 1 year ago

@huan415201 I have the same problem... did you solve your problem?

jorisvo2 commented 1 year ago

@huan415201 Any news about this issue ?

snowepiphany commented 9 months ago

any updates about this issue?