Protect and Unprotect Workbook Structure
Contents
[
Hide
]
To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets, you can protect the structure of your Excel workbook with a password.
Protect and unprotect Workbook Structure in MS Excel
- Click Review > Protect Workbook.
- Enter a password in the Password box.
- Select OK, re-enter the password to confirm it, and then select OK again.
Protect Workbook Structure Using Aspose.Cell for Java
Only need the following simple lines of code to implement protecting workbook structure of Excel files.
This file contains 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
//Create a new file. | |
Workbook workbook = new Workbook(); | |
//Protect workbook structure. | |
workbook.protect(ProtectionType.STRUCTURE, "password"); | |
//Save Excel file. | |
workbook.save("Book1.xlsx"); |
Unprotect Workbook Structure Using Aspose.Cell for Java
Unprotecting workbook structure is easy with Aspose.Cells API.
This file contains 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
//Open an Excel file which workbook structure is protected. | |
Workbook workbook = new Workbook("Book1.xlsx"); | |
//Unprotect workbook structure. | |
workbook.unprotect("password"); | |
//Save Excel file. | |
workbook.save("Book1.xlsx"); |
Note: a correct password is required.