Skip to content

Font Colors aren't Consistent #669

@jacoblockett

Description

@jacoblockett

I'm attempting to only change the font color of a row that is being passed into a function:

write(workbook, sheet, info, row_no, chart_path) {
  const worksheet = workbook.getWorksheet(sheet)
  const row = worksheet.getRow(row_no)
  const no_3 = info[2].slice(0, info[2].length - 1)

  row.font = {color: {argb: 'FFFF0000'}}

  row.eachCell({includeEmpty: true}, (cell, col_no) => {
    col_no === 1 && (cell.value = info[0])
    col_no === 2 && (cell.value = info[1])
    col_no > 3 && no_3.forEach((i, i_no) => {
      col_no - 4 === i_no && (cell.value = i)
    })
  })

  workbook.xlsx.writeFile(chart_path)
    .then(() => console.log('done'))
    .catch(error => console.error(error))
}

Unfortunately when I run this it changes every row between an arbitrary number (i.e. rows 5-14) instead of just the row I specify. Any reason for this that someone can see, or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions