Skip to content

[BUG] Incorrectly handles '/', ':' characters in sheet name #1474

Closed
@artemovskiy

Description

@artemovskiy

🐛 Bug Report

If the desired name of the worksheet contains characters /, : it does not affect on actual sheet name. When I open created file via MS Excel is see default worksheet names like 'Sheet 1'. Some versions of MS Excel also show error messages and warn about file corruption.

Lib version: 4.1.1

Steps To Reproduce

  1. Have exceljs@4.1.1 installed (obviously)
  2. Run following code:
const {Workbook} = require('exceljs')

const workbook = new Workbook()
const sheet = workbook.addWorksheet('http://a.b/c')
sheet.addRow(['a', 'b', 'c'])
workbook.xlsx.writeFile('./result.xlsx')
  1. See 'Sheet 1' instead of desired sheet name in created file

The expected behaviour:

Sheet name to be equal to first argument of addWorksheet call.

Possible solution (optional, but very helpful):

If it is xlsx constraint, throw an error, when client attempts to put unsupported characters into sheet name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions