gitbrent/xlsx-js-style

xlsx.read cellStyles: true not working

Opened this issue · 3 comments

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

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

@huan415201 Any news about this issue ?

any updates about this issue?