PPT处理控件Aspose.Slides功能演示:使用C ++以编程方式将PPT转换为HTML

演示文稿(PPTX / PPT)经常用于向大量受众描述信息。在本文中,我们将讨论如何将PowerPoint Presentation转换为HTML。

演示文稿(PPTX / PPT)经常用于向大量受众描述信息。在本文中,我们将讨论如何将PowerPoint Presentation转换为HTML。当要在Web应用程序,网站等中展示信息时,此用例可能会有所帮助。

Aspose.Slides for C++已经迎来2020年8月更新,增强了多项功能,如果你还没有升级Aspose.Slides最新版测试,可以点击这里下载

PPT处理控件Aspose.Slides功能演示:使用C ++以编程方式将PPT转换为HTML

  • 使用C ++将整个演示文稿(PPTX / PPT)转换为HTML
  • 使用C ++将特定的演示幻灯片(PPTX / PPT)导出为HTML
  • 使用C ++将每个演示文稿幻灯片(PPTX / PPT)转换为单独的HTML文件

整合所有格式API处理套包Aspose.Slides正在网火热销售中,新购优惠折上折!联系客服立马1分钟了解全部咨询!


使用C ++将整个演示文稿(PPTX / PPT)转换为HTML

在这种情况下,您需要将完整的PowerPoint演示文稿(PPTX / PPT)转换为HTML文件格式。输出的HTML文件将包含源PPTX文件中所有幻灯片的内容。您需要按照以下步骤进行转换。

  • 加载输入的PPTX文件作为演示文稿
  • 初始化HtmlSaveOptions类对象
  • 保存输出HTML网页

下面的代码显示了如何使用C ++将PowerPoint演示文稿转换为HTML。

const String outPath = u"../out/ConvertWholePresentationToHTML_out.html";const String templatePath = u"../templates/AccessSlides.pptx";//Instantiate Presentation class that represents PPTX fileSharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);SharedPtr<ResponsiveHtmlController> controller = MakeObject<ResponsiveHtmlController>();SharedPtr<HtmlOptions> htmlOptions = MakeObject <HtmlOptions>();htmlOptions->set_HtmlFormatter((HtmlFormatter::CreateSlideShowFormatter(u"", false)));pres->Save(outPath, SaveFormat::Html, htmlOptions);

使用C ++将特定的演示幻灯片(PPTX / PPT)导出为HTML

巨大的PowerPoint演示文稿中的某些幻灯片可能包含特定的信息。例如,就像您需要特定幻灯片上图表的某些信息一样,则可以将该幻灯片转换或导出为HTML。以下是达到这些要求的步骤:

  • 实例化Presentation类对象
  • 指定HtmlOptions进行转换
  • 保存转换后的HTML文件

下面的代码段显示了如何使用C ++将特定的幻灯片转换为HTML:

// The path to the documents directory.const String outPath = u"../out/";const String templatePath = u"../templates/AccessSlides.pptx";//Instantiate Presentation class that represents PPTX fileSharedPtrpres = MakeObject(templatePath);SharedPtrhtmlOptions = MakeObject();htmlOptions->set_HtmlFormatter(HtmlFormatter::CreateCustomFormatter(System::MakeObject())); // Saving second slide to HTML File      pres->Save(outPath + u"Individual Slide" + (2) + u"_out.html", System::MakeArray({ 2 }), SaveFormat::Html, htmlOptions);

使用C ++将每个演示文稿幻灯片(PPTX / PPT)转换为单独的HTML文件

可以按照以下步骤将演示文稿的每张幻灯片转换为单独的HTML文件。

  • 使用Presentation类加载PPT / PPTX文件
  • 遍历每张幻灯片并将其另存为HTML

下面是一个代码段,显示了如何将Presentation文件的所有幻灯片转换为单独的HTML文件:

// The path to the documents directory.const String outPath = u"../out/";const String templatePath = u"../templates/AccessSlides.pptx";//Instantiate Presentation class that represents PPTX fileSharedPtrpres = MakeObject(templatePath);SharedPtrhtmlOptions = MakeObject();htmlOptions->set_HtmlFormatter(HtmlFormatter::CreateCustomFormatter(System::MakeObject())); // Saving each slide as separate HTML filefor (int i = 0; i < pres->get_Slides()->get_Count(); i++){pres->Save(outPath + u"Individual Slide" + (i + 1) + u"_out.html", System::MakeArray({ i + 1 }), SaveFormat::Html, htmlOptions);}


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

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年8月5日
下一篇 2020年8月5日

相关推荐

发表回复

登录后才能评论