Skip to content

fill.bgColor is not working. #18

Open
@jhunexjun

Description

@jhunexjun
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions