使用 Python 保护 ODP 演示文稿
Aspose.Slides for Python via .NET
提供两种不同的保护机制。调用 ProtectionManager.encrypt 可加密 ODP 演示文稿,打开时需要输入密码。也可以调用 ProtectionManager.set_write_protection,在不加密文件的情况下阻止修改。用户仍可打开写保护的演示文稿,并将更改保存到其他文件中。
加密 ODP 演示文稿 – Python
with slides.Presentation("presentation.odp") as presentation:
presentation.protection_manager.encrypt("123123")
presentation.save("encrypted-presentation.odp", slides.export.SaveFormat.ODP)为 ODP 演示文稿设置写保护 – Python
with slides.Presentation("presentation.odp") as presentation:
presentation.protection_manager.set_write_protection("123123")
presentation.save("write-protected-presentation.odp", slides.export.SaveFormat.ODP)如何使用 Python 保护 ODP
按照以下步骤保护 ODP 文件。
- 使用
Presentation打开 ODP 文件。 - 使用
ProtectionManager.encrypt要求打开时输入密码,或使用ProtectionManager.set_write_protection阻止更改。 - 使用
SaveFormat.ODP将受保护的演示文稿另存为 ODP。
基于 Aspose.Slides 构建
在线为 ODP 文件设置密码保护
免费的 Aspose.Slides Lock 应用基于 Aspose.Slides for Python via .NET 构建,与上方代码使用的是同一 API。打开它,看看 API 能如何处理您自己的 ODP 文件。
- 在浏览器中运行,无需安装任何软件。
- 在编写代码之前,先了解 Aspose.Slides 如何保护演示文稿。
- 设置打开或编辑 ODP 文件所需的密码。
- 下载受保护的文件。
其他支持保护的格式
使用 Python 保护其他受支持的演示文稿格式。