使用 Java 解锁 PPT

构建通过服务器端 API 移除演示文稿文件密码和写保护的 Java 应用程序。

通过 Java 移除 PPT 演示文稿的保护

借助 Aspose.Slides for Java ,您可以移除 PPT 演示文稿的加密或写保护。使用 LoadOptions.setPassword 打开加密的演示文稿,并使用 ProtectionManager 的 removeEncryption 和 removeWriteProtection 方法移除保护设置。

使用 Java 移除 PPT 的密码保护

LoadOptions loadOptions = new LoadOptions();
loadOptions.setPassword("123123");

Presentation presentation = new Presentation("presentation.ppt", loadOptions);
try {
    presentation.getProtectionManager().removeEncryption();
    presentation.save("encryption-removed.ppt", SaveFormat.Ppt);
} finally {
    presentation.dispose();
}

使用 Java 移除 PPT 演示文稿的写保护

Presentation presentation = new Presentation("presentation.ppt");
try {
    presentation.getProtectionManager().removeWriteProtection();
    presentation.save("write-protection-removed.ppt", SaveFormat.Ppt);
} finally {
    presentation.dispose();
}

如何通过 Java 移除 PPT 的密码

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

  1. 使用 Presentation 类加载 PPT 文件。
  2. 如果演示文稿已加密,请使用 LoadOptions.setPassword。
  3. 调用 ProtectionManager 对象的 removeEncryption 或 removeWriteProtection。
  4. 使用 SaveFormat.Ppt 保存解锁后的演示文稿。

基于 Aspose.Slides 构建

在线解锁 PPT 文件

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

  • 在浏览器中运行,无需安装任何软件。
  • 在编写代码之前,先了解 Aspose.Slides 如何移除保护。
  • 移除 PPT 文件的密码或写保护。
  • 下载解锁后的文件。

其他支持解锁的格式

使用 Java,您还可以移除以下格式的保护。