PPT处理控件Aspose.Slides功能演示:在C#中实现将PPT演示文稿转换为 Word DOCX

  • 在 C# 中将 PPTX 或 PPT 转换为 DOCX

为了将 PowerPoint 演示文稿转换为 Word 文档,我们将结合使用Aspose.Slides for Java和Aspose.Words for .NET,前者是一种演示操作 API,可让您创建或修改 PowerPoint 演示。而后者是用于生成或处理 Word 文档的文字处理 API。

>>你可以点击这里下载Aspose.Slides 最新版测试体验。

PPT处理控件Aspose.Slides功能演示:在C#中实现将PPT演示文稿转换为 Word DOCX

在 C# 中将 PowerPoint PPTX 或 PPT 转换为 DOCX

以下是使用 C# 将 PowerPoint 演示文稿转换为 Word 文档的步骤。

  • 首先,将 Aspose.Words for .NET 和 Aspose.Slides for .NET 的引用添加到您的项目中。
  • 之后,使用Aspose.Slides.Presentation类加载 PowerPoint 演示文稿。
  • 然后,将演示文稿保存到MemoryStream对象中。
  • 创建一个Aspose.Words.Document类的对象并使用MemoryStream对象对其进行初始化。
  • 最后,使用Aspose.Words.Document.Save(string, Aspose.Words.SaveFormat.Docx)方法保存文档。

以下代码示例展示了如何使用 C# 将 PPTX 转换为 DOCX。

// Load the PowerPoint presentationusing(Aspose.Slides.Presentation presentation = new Aspose.Slides.Presentation("pres.pptx")){  using (var stream = new MemoryStream())  {      // Save presentation to memory stream      presentation.Save(stream, SaveFormat.Html);      stream.Flush();      stream.Seek(0, SeekOrigin.Begin);      // Load the content of the presentation to a Word document      var doc = new Aspose.Words.Document(stream);       // Save the Word document      doc.Save("pres.docx", Aspose.Words.SaveFormat.Docx);  }}

如果你想试用Aspose的全部完整功能,可联系在线客服获取30天临时授权体验。


还想要更多吗可以点击阅读【Aspose最新资源在线文库】查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群(),我们很高兴为您提供查询和咨询
标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年7月2日
下一篇 2021年7月2日

相关推荐

发表回复

登录后才能评论