Spire.Presentation for Java 专业的 PowerPoint API,它允许开发人员在 Java 应用程序中创建、读取、写入、转换和保存 PowerPoint 文档,而无需安装 Microsoft PowerPoint。
本文向您展示如何使用 Spire.Presentation for Java 将 PowerPoint 文档转换为 HTML 格式文件。可下载最新版测试。
下面是示例PowerPoint文档的屏幕截图。
import com.spire.presentation.FileFormat;
import com.spire.presentation.Presentation;
public class ToHtml {
public static void main(String[] args) throws Exception {
//Create a Presentation object
Presentation presentation = new Presentation();
//Load the sample document
presentation.loadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pptx");
//Save the document to HTML format
presentation.saveToFile("C:\\Users\\Administrator\\Desktop\\ToHtml.html", FileFormat.HTML);
}
}
输出文件