Convert PPTX to Word in C++

Export PowerPoint slide content to Word using Aspose.Slides for C++ and Aspose.Words for C++.

Convert PowerPoint to Word in C++

Use this C++ code to convert PPTX to Word:

PPTX to Word C++ Conversion Source Code

auto presentation = MakeObject<Presentation>(u"presentation.pptx");
auto wordDocument = MakeObject<Aspose::Words::Document>();
auto documentBuilder = MakeObject<Aspose::Words::DocumentBuilder>(wordDocument);

auto slideSize = Size(1200, 800);
for (auto&& slide : presentation->get_Slides())
{
    auto slideImage = slide->GetImage(slideSize);
    auto imageStream = MakeObject<System::IO::MemoryStream>();
    slideImage->Save(imageStream, Aspose::Slides::ImageFormat::Png);
    imageStream->set_Position(0);

    documentBuilder->InsertImage(imageStream);

    imageStream->Dispose();
    slideImage->Dispose();

    documentBuilder->InsertBreak(Aspose::Words::BreakType::PageBreak);
}

wordDocument->Save(u"presentation.docx");
presentation->Dispose();

Convert PowerPoint to Word Using Aspose.Slides and Aspose.Words

Aspose.Slides for C++ can render slides as images, while Aspose.Words for C++ can create and save Word documents. Use both APIs when you need to move PPTX slide content into a DOCX document.

How to Convert PPTX to Word

  1. Install Aspose.Slides for C++ and Aspose.Words for C++.
  2. Create a Presentation instance from the source PPTX file.
  3. Create a Word Document and DocumentBuilder.
  4. Render slides with GetImage, insert the rendered images with DocumentBuilder, and save the result as DOCX.

Built with Aspose.Slides

Convert PPTX to Word Online

The free Aspose.Slides Conversion app is built with Aspose.Slides for C++, the same API as the code above. Open it and see what the API can do with your own PPTX files.

  • Runs in your browser, nothing to install.
  • See how Aspose.Slides converts files before you write code.
  • Upload PPTX files and save them as Word.
  • Download the result or convert more files.

Other Supported Conversions

You can also convert PowerPoint to files in other formats.