# 使用 Python 保护 ODP 演示文件

> Python 源代码保护 ODP 演示。

Source: https://products.aspose.com/slides/zh/python-net/protect/odp/
Updated: 2023-04-26



## 通过 Python 保护 ODP 演示文稿

使用 Aspose.Slides for Python via .NET，您可以通过设置密码来保护您的 ODP 演示文稿不被打开或修改。然后，要打开或修改锁定的演示文稿，用户必须提供密码。

### 使用 Python 加密 ODP 演示文稿

```py

import aspose.slides as slides

with slides.Presentation("pres.odp") as pres:
    pres.protection_manager.encrypt("123123")
    pres.save("encrypted-pres.odp", slides.export.SaveFormat.ODP)
```

### 使用 Python 为 ODP 演示文稿设置写保护

```py

import aspose.slides as slides

with slides.Presentation("pres.odp") as pres:
    pres.protection_manager.set_write_protection("123123")
    pres.save("write-protected-pres.odp", slides.export.SaveFormat.ODP)
```

## 如何通过 Python 密码保护 ODP

这些是保护 ODP 文件的步骤。

使用 Presentation 实例加载 ODP

使用 ProtectionManager 类保护演示文稿

以 ODP 格式保存结果

## 其他支持的保护格式
