exceljs / exceljs

Excel Workbook Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Unlocked cells lose their vertical and horizontal alignment after a read and write.

Punknium opened this issue Β· comments

πŸ› Bug Report

If I read in an xlsx file and then write it back out any unlocked cell will lose their vertical and horizontal alignments.

Lib version: 3.8.2

Steps To Reproduce

Read and write an xlsx file.

Here is a before and after example. See cell E4
ExcelJS-FormattingLockedCellAndDatavalidation.xlsx
ExcelJS-AFTER-FormattingLockedCellAndDatavalidation.xlsx

async load() {
  try {
    const wb = new ExcelJS.Workbook()
    await wb.xlsx.load(await this.file.arrayBuffer())
    const out = await wb.xlsx.writeBuffer()
    this.download(out)
  } catch (e) {
    console.error(e)
  }
}

The expected behaviour:

Unlocked cells should maintain their vertical and horizontal alignments.

See PR #1210 .