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

fill.bgColor is not working. #18

Open
jhunexjun opened this issue Jan 7, 2025 · 0 comments
Open

fill.bgColor is not working. #18

jhunexjun opened this issue Jan 7, 2025 · 0 comments

Comments

@jhunexjun
Copy link

const totalsCosmetics = { // set the style for target cell
  font: {
    bold: true,
    color: { rgb: "CCFFCC" }
  },
  fill: {
    bgColor: { rgb: "FF0000" }
  }
}

function addCosmetics(ws, range, headerFormat) {
  // set styling of the header cells.
  for(let R = range.s.r; R <= range.e.r; ++R) {
    for(let C = range.s.c; C <= range.e.c; ++C) {
      let cell_address = { c:C, r:R }
      /* if an A1-style address is needed, encode the address */
      let cell_ref = XLSX.utils.encode_cell(cell_address)
      ws[cell_ref].s = headerFormat
    }
  }
}

addCosmetics(ws, { s:{ c:0, r:(aoa.length - 1) }, e:{ c:18, r:(aoa.length - 1) } }, totalsCosmetics)

The color for the font seems to be working but the background is not. It actually has background but the color is always black. See sample output below:

image
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

1 participant