Skip to content

Styles get infinitely propagated to all rows #302

@rclai

Description

@rclai

v0.42.0

function makeBordersForRow(rowNumber, columnCount, worksheet) {
  for (let i = 1; i <= columnCount; i++) {
    worksheet.getRow(rowNumber).getCell(i).border = {
      top: { style:'thin', color: { argb:'000000' } },
      left: { style:'thin', color: { argb:'000000' } },
      bottom: { style:'thin', color: { argb:'000000' } },
      right: { style:'thin', color: { argb:'000000' } }
    };
  }
}

const maxColumns = 10;
const maxRows = 20;
for (let rowNum = 1; rowNum < maxRows; rowNum++) {
    makeBordersForRow(rowNum, maxColumns, worksheet);
}

This code is supposed to put black borders to 20 rows on 10 columns, however, the borders don't stop at row 20, they get applied to all rows (10 columns still).

I've seen this happen with font styles as well, however, I found out that using the .values = [] operation resets the styles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions