Skip to content

[BUG] WorkbookWriter sheet.protect() function doesn't exist #1261

@rheidari

Description

@rheidari

🐛 Bug Report

Unable to add cell level protection on worksheet when using the streaming WorkbookWriter due to sheet.protect() not existing in worksheet-writer.js.

Lib version: 3.9.0

Steps To Reproduce

const workbook = new Excel.stream.xlsx.WorkbookWriter({
     filename: './test.xlsx',
});

const sheet = workbook.addWorksheet('data');
const row = sheet.addRow(['readonly cell']);
row.getCell(1).protection = { locked: true };

expect(sheet.protect).to.exist();
await sheet.protect('password');

await workbook.commit();

The expected behavior:

Should create a file that can be opened and 'readonly cell' should have protection.

Possible solution (optional, but very helpful):

Add protect method to worksheet-writer.js

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