Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created September 4, 2020 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/9421c9bffced10a94c4f9eb8b5e0a983 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/9421c9bffced10a94c4f9eb8b5e0a983 to your computer and use it in GitHub Desktop.
Convert PowerPoint Presentation PPTX PPT to Webpage HTML using C++
// 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
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
SharedPtr<HtmlOptions> htmlOptions = MakeObject<HtmlOptions>();
htmlOptions->set_HtmlFormatter(HtmlFormatter::CreateCustomFormatter(System::MakeObject<CustomFormattingController>()));
// 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<int32_t>({ i + 1 }), SaveFormat::Html, htmlOptions);
}
// 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
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
SharedPtr<HtmlOptions> htmlOptions = MakeObject<HtmlOptions>();
htmlOptions->set_HtmlFormatter(HtmlFormatter::CreateCustomFormatter(System::MakeObject<CustomFormattingController>()));
// Saving second slide to HTML File
pres->Save(outPath + u"Individual Slide" + (2) + u"_out.html", System::MakeArray<int32_t>({ 2 }), SaveFormat::Html, htmlOptions);
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment