Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xlsx.read cellStyles: true not working #18

Open
huan415201 opened this issue Jan 10, 2023 · 3 comments
Open

xlsx.read cellStyles: true not working #18

huan415201 opened this issue Jan 10, 2023 · 3 comments

Comments

@huan415201
Copy link

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
Copy link

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

@jorisvo2
Copy link

@huan415201 Any news about this issue ?

@snowepiphany
Copy link

any updates about this issue?

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

No branches or pull requests

4 participants