Convert PowerPoint Presentations to Word Documents in C++
If you plan to use textual content or information from a presentation (PPT or PPTX) in new ways, you may benefit from converting the presentation to Word (DOC or DOCX).
- When compared to Microsoft PowerPoint, the Microsoft Word app is more equipped with tools or functionalities for content.
- Besides the editing functions in Word, you may also benefit from enhanced collaboration, printing, and sharing features.
Aspose.Slides and Aspose.Words
To convert a PowerPoint file (PPTX or PPT) to Word (DOCX or DOCX), you need both Aspose.Slides for C++ and Aspose.Words for C++.
As a standalone API, Aspose.Slides for C++ provides functions that allow you to extract texts from presentations.
Aspose.Words is an advanced document processing API that allows applications to generate, modify, convert, render, print files, and perform other tasks with documents without utilizing Microsoft Word.
Convert a PowerPoint Presentation to a Word Document
Use this code snippet to convert the PowerPoint to Word:
auto presentation = MakeObject<Presentation>();
auto doc = MakeObject<Aspose::Words::Document>();
auto builder = MakeObject<Aspose::Words::DocumentBuilder>(doc);
for (const auto& slide : presentation->get_Slides())
{
// generates and inserts slide image
auto image = slide->GetImage(1.0f, 1.0f);
builder->InsertImage(image);
// inserts slide's texts
for (const auto& shape : slide->get_Shapes())
{
if (ObjectExt::Is<AutoShape>(shape))
{
auto autoShape = System::AsCast<AutoShape>(shape);
builder->Writeln(autoShape->get_TextFrame()->get_Text());
}
}
builder->InsertBreak(Aspose::Words::BreakType::PageBreak);
}
FAQ
What components need to be installed to convert PowerPoint and OpenDocument presentations to Word documents?
You only need to add the respective packages for Aspose.Slides for C++ and Aspose.Words for C++ to your project. Both libraries operate as standalone APIs, and there is no requirement for Microsoft Office to be installed.
Are all PowerPoint and OpenDocument presentation formats supported?
Aspose.Slides supports all presentation formats, including PPT, PPTX, ODP, and other common file types. This ensures that you can work with presentations created in various versions of Microsoft PowerPoint.