exceljs / exceljs

Excel Workbook Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

rheidari opened this issue Β· comments

πŸ› 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

@rheidari / @Alanscut Any ETA for merging PR for this issue? We wanted to use this library but this is the only thing that is blocking us.

I have approved the fix PR, and wait for other members to review it.

Hi @Alanscut, sorry to bug again about this. Just wanted to know if we have ETA for this as we have first production release next month. And it is important for us to lock excel. If this will take time, we will start working on alternatives. Thank you for the support and great library :)