翻譯|使用教程|編輯:李顯亮|2020-09-08 10:19:59.723|閱讀 394 次
概述:演示文稿(PPTX / PPT)經常用于向大量受眾描述信息。在本文中,我們將討論如何將PowerPoint Presentation轉換為HTML。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
演示文稿(PPTX / PPT)經常用于向大量受眾描述信息。在本文中,我們將討論如何將PowerPoint Presentation轉換為HTML。當要在Web應用程序,網站等中展示信息時,此用例可能會有所幫助。
Aspose.Slides for C++已經迎來2020年8月更新,增強了多項功能,如果你還沒有升級Aspose.Slides最新版測試,可以點擊這里下載。
在這種情況下,您需要將完整的PowerPoint演示文稿(PPTX / PPT)轉換為HTML文件格式。輸出的HTML文件將包含源PPTX文件中所有幻燈片的內容。您需要按照以下步驟進行轉換。
下面的代碼顯示了如何使用C ++將PowerPoint演示文稿轉換為HTML。
const String outPath = u"../out/ConvertWholePresentationToHTML_out.html"; const String templatePath = u"../templates/AccessSlides.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr<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);
巨大的PowerPoint演示文稿中的某些幻燈片可能包含特定的信息。例如,就像您需要特定幻燈片上圖表的某些信息一樣,則可以將該幻燈片轉換或導出為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 file SharedPtrpres = 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);
可以按照以下步驟將演示文稿的每張幻燈片轉換為單獨的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 file SharedPtrpres = MakeObject(templatePath); SharedPtrhtmlOptions = MakeObject(); htmlOptions->set_HtmlFormatter(HtmlFormatter::CreateCustomFormatter(System::MakeObject())); // Saving each slide as separate HTML file for (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); }
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn