Adressing the "view password" feature implementation- Issue #577#612
Merged
Conversation
Collaborator
|
Thank you for your contribution! Could you add a note to the README about this new feature? Thanks! |
Added instructions for protecting a worksheet from viewing in the README.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added
protectWithViewPassword(String password)toWorksheet,allowing users to hide a sheet and lock the workbook structure
with a password so unauthorized users cannot unhide it.
How it works
Worksheet.protectWithViewPassword(password)hides the sheetby setting its visibility state to HIDDEN and calls
Workbook.protectStructure(password)to lock the workbook structure.Workbook.protectStructure(password)hashes the password and writes<workbookProtection workbookPassword="..." lockStructure="1"/>to workbook.xml.
Usage
java Worksheet ws = wb.newWorksheet("SecretSheet"); ws.value(0, 0, "Sensitive Data"); ws.protectWithViewPassword("myPassword");Testing
WorkbookProtectionTest: verifies workbook structure lockingViewPasswordE2ETest: verifies full round-trip: sheetvisibility, data preservation and combined view/edit protection
As is the case with the pre-existing password, this is not full file encryption.
It uses Excel's built-in sheet hiding and workbook structure protection, which is meant to
discourage casual access rather than provide strong security.