保护和取消保护工作簿结构
Contents
[
Hide
]
为防止其他用户查看隐藏工作表、添加、移动、删除或隐藏工作表,并重命名工作表,您可以使用密码保护 Excel 工作簿的结构。
在 MS Excel 中保护和取消保护工作簿结构
- 点击 审阅 > 保护工作簿。
- 在 密码框 中输入密码。
- 选择 确定,重新输入密码以确认,然后再次选择 确定。
使用 Aspose.Cells for Python via .NET 保护工作簿结构
只需要以下简单代码行来实现保护 Excel 文件的工作簿结构。
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
from aspose.cells import ProtectionType, Workbook | |
# Create a new file. | |
workbook = Workbook() | |
# Protect workbook structure. | |
workbook.protect(ProtectionType.STRUCTURE, "password") | |
# Save Excel file. | |
workbook.save("Book1.xlsx") |
使用 Aspose.Cells for Python via .NET 取消保护工作簿结构
使用 Aspose.Cells for Python via .NET API 取消保护工作簿结构非常简单。
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
from aspose.cells import Workbook | |
# Open an Excel file which workbook structure is protected. | |
workbook = Workbook("Book1.xlsx") | |
# Unprotect workbook structure. | |
workbook.unprotect("password") | |
# Save Excel file. | |
workbook.save("Book1.xlsx") |
注意:需要正确的密码。