使用 C++ 锁定 PPT 或为其设置密码保护

使用 Aspose.Slides for C++ 加密演示文稿并设置写保护,无需 Microsoft PowerPoint。

通过 C++ 保护 PPT 演示文稿

Aspose.Slides for C++ 可防止 PPT 演示文稿被打开或修改。使用 Presentation 类中的 ProtectionManager 对象,通过 Encrypt 加密文件,或通过 SetWriteProtection 限制编辑。

使用 C++ 加密 PPT 演示文稿

auto presentation = MakeObject<Presentation>(u"presentation.ppt");

presentation->get_ProtectionManager()->Encrypt(u"password");
presentation->Save(u"encrypted-presentation.ppt", SaveFormat::Ppt);
presentation->Dispose();

使用 C++ 为 PPT 演示文稿设置写保护

auto presentation = MakeObject<Presentation>(u"presentation.ppt");

presentation->get_ProtectionManager()->SetWriteProtection(u"password");
presentation->Save(u"write-protected-presentation.ppt", SaveFormat::Ppt);
presentation->Dispose();

如何通过 C++ 为 PPT 设置密码保护

按照以下步骤保护 PPT 演示文稿。

  1. 使用 Presentation 类加载 PPT 文件。
  2. 使用 ProtectionManager 对象保护演示文稿。
  3. 使用 Encrypt 设置密码保护,或使用 SetWriteProtection 设置写保护。
  4. 使用 SaveFormat::Ppt 保存受保护的文件。

基于 Aspose.Slides 构建

在线为 PPT 文件设置密码保护

免费的 Aspose.Slides Lock 应用基于 Aspose.Slides for C++ 构建,与上方代码使用的是同一 API。打开它,看看 API 能如何处理您自己的 PPT 文件。

  • 在浏览器中运行,无需安装任何软件。
  • 在编写代码之前,先了解 Aspose.Slides 如何保护演示文稿。
  • 设置打开或编辑 PPT 文件所需的密码。
  • 下载受保护的文件。

其他支持保护的格式

使用 C++,您还可以保护以下格式。