- 使用 C++ 将 PowerPoint PPTX/PPT 文件转换为 DOCX 格式
为了将 PowerPoint 演示文稿转换为 Word 文档,我们将使用
使用 C++ 将 PowerPoint PPTX/PPT 文件转换为 DOCX 格式
以下是使用 C++ 将 PowerPoint PPTX/PPT 文件转换为 DOCX 格式的步骤。
- 使用Aspose::Slides::Presentation 类加载 PowerPoint 文件 。
- 创建MemoryStream类的实例。
- 将演示文稿保存到流中。
- 使用流对象创建Aspose::Words::Document类的实例。
- 使用Aspose::Words::Document->Save(const System::String & fileName, Aspose::Words::SaveFormat saveFormat)方法保存 DOCX 文件。
以下示例代码显示了如何使用 C++ 将 PowerPoint PPTX/PPT 文件转换为 DOCX 格式。
/ File pathsconst String sourceFilePath = u"SourceDirectory\Slides\SamplePresentation.pptx";const String outputFilePath = u"OutputDirectory\SlidesToWord_out.docx";// Load the presentation fileauto presentation = System::MakeObject(sourceFilePath);// Create an instance of the MemoryStream classauto stream = System::MakeObject();// Save the presentation to the streampresentation->Save(stream, SaveFormat::Html);stream->Flush();stream->Seek(0, SeekOrigin::Begin);// Create an instance of the Document class using the streamauto doc = System::MakeObject(stream);// Save the Word documentdoc->Save(outputFilePath, Aspose::Words::SaveFormat::Docx);
如果你想试用Aspose的全部完整功能,可联系在线客服获取30天临时授权体验。
还想要更多吗可以点击阅读【Aspose最新资源在线文库】,查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群(),我们很高兴为您提供查询和咨询。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!