Merge ODP Files in PHP

Combine ODP presentations with Aspose.Slides for PHP via Java.

Merge ODP in PHP

Aspose.Slides for PHP via Java can combine multiple ODP presentations into one file. The API clones slides from each source presentation into a destination presentation while retaining their content and formatting.

Merge ODP files using PHP

To merge ODP presentations, load both files, clone each source slide into the destination presentation with addClone, and save the result in ODP format.

PHP code for merging multiple ODP files

$destinationPresentation = new Presentation("document1.odp");
$sourcePresentation = new Presentation("document2.odp");
try {
    $slideCount = java_values($sourcePresentation->getSlides()->size());

    for ($slideIndex = 0; $slideIndex < $slideCount; $slideIndex++) {
        $slide = $sourcePresentation->getSlides()->get_Item($slideIndex);
        $destinationPresentation->getSlides()->addClone($slide);
    }

    $destinationPresentation->save("merged.odp", SaveFormat::Odp);
} finally {
    $sourcePresentation->dispose();
    $destinationPresentation->dispose();
}

How to merge ODP files in PHP

Follow these steps to merge two ODP files and save the result as ODP in PHP.

  1. Install Aspose.Slides for PHP via Java. See Installation .

  2. Configure Aspose.Slides in your PHP project.

  3. Load the source and destination ODP files with the Presentation class, then clone each source slide with addClone.

  4. Call save with the output file path and SaveFormat::Odp.

Merge ODP with Other Supported Formats

You can also combine ODP with presentations in other supported formats.