Addition for write protected sheets #363

Closed
Mior wants to merge 0 commits from master into master
Mior commented 2016-02-04 09:53:10 +00:00 (Migrated from github.com)

I have added write protection for xml sheets using password hash from http://www.openoffice.org/sc/excelfileformat.pdf format.
It was tested and its working well. It is nothing but addition of one tag to sheet.

I have added write protection for xml sheets using password hash from http://www.openoffice.org/sc/excelfileformat.pdf format. It was tested and its working well. It is nothing but addition of one tag <sheetProtection> to sheet.
lsholubka commented 2017-03-13 19:01:17 +00:00 (Migrated from github.com)

Hello, any updates on this? That would be a great feature to have.

Hello, any updates on this? That would be a great feature to have.
SheetJSDev commented 2017-03-23 04:52:54 +00:00 (Migrated from github.com)

The relevant sections of the official specs include

  • ECMA-376 Section 18.3.1.85 for XLSX
  • MS-XLSB BrtSheetProtection record
  • MS-XLS Protect and XF records
  • MS-OFFCRYPTO password hashes

Keys attached to the worksheet object should be prefixed with an exclamation point (like !ref or !cols).

The relevant sections of the official specs include - ECMA-376 Section 18.3.1.85 for XLSX - MS-XLSB BrtSheetProtection record - MS-XLS Protect and XF records - MS-OFFCRYPTO password hashes Keys attached to the worksheet object should be prefixed with an exclamation point (like `!ref` or `!cols`).
SheetJSDev commented 2017-04-04 17:25:00 +00:00 (Migrated from github.com)

Started digging into this, looks straightforward but we're going to have to make some changes (I'll rewrite the commit):

  • According to MS-XLSB, the sheet protection info should show up after the data table but before the merge cells. The write line was put in the right position

  • The worksheet key should be !sheetProtection

  • There are two helper functions for generating the XML: wxt_helper will generate the attribute string and writextag will generate the xml tag given a tag name, body, and properties object; and wxt_helper. In this case you could just use writextag on the sheetProtection object.

  • According to MS-XLSB, the actual password verifier algorithm is based on [MS-OFFCRYPTO] section 2.3.7.1, Binary Document Password Verifier Derivation Method 1. Incidentally we have that algorithm!.

Started digging into this, looks straightforward but we're going to have to make some changes (I'll rewrite the commit): - According to MS-XLSB, the sheet protection info should show up after the data table but before the merge cells. The write line was put in the right position - The worksheet key should be `!sheetProtection` - There are [two helper functions](https://github.com/SheetJS/js-xlsx/blob/master/bits/22_xmlutils.js#L150-L151) for generating the XML: `wxt_helper` will generate the attribute string and `writextag` will generate the xml tag given a tag name, body, and properties object; and `wxt_helper`. In this case you could just use writextag on the sheetProtection object. - According to [MS-XLSB](https://msdn.microsoft.com/en-us/library/dd944996.aspx), the actual password verifier algorithm is based on [MS-OFFCRYPTO] section 2.3.7.1, Binary Document Password Verifier Derivation Method 1. Incidentally [we have that algorithm!](https://github.com/SheetJS/js-xlsx/blob/master/bits/44_offcrypto.js#L60).

Pull request closed

Sign in to join this conversation.
No description provided.