A PPT File Requires Repair After Processing a Template Using Java

Hello Aspose Team!

We have a PPT template that, when uploaded to PowerPoint 365, does not seem to have any issues.
However after we process the template, uploading the result ends up in a “We repaired your presentation” error. We’ve had someone test out each individual slide to see if we were doing something wrong in a specific slide. However output files from templates containing only one slide seem to work fine when uploaded to PowerPoint 365. Could you help us debug this? Or if you could, point us to any tools or functions that would help us debug templates to figure out the root cause? Any direction would be helpful, we are running into this issue with several templates and our clients find the error message concerning.

files.zip (3.3 MB)

@ecodev

It sounds like you’re encountering a frustrating issue with your PPT templates after processing them. Here’s a structured approach to resolve the problem:

Cause: The issue may stem from corrupt elements within the slides, unsupported features, or incorrect document properties.

Solution: Follow these steps to debug the problem:

  1. Check for Corrupt Elements: Isolate each slide and examine them for unusual formatting, unsupported features, or corrupt objects.

  2. Use Aspose.Slides Diagnostics: Utilize the Presentation class to load your presentation and monitor for any exceptions or errors during the loading process. This can help pinpoint problematic slides or elements.

  3. Validate Document Properties: Access and modify the document properties using the IDocumentProperties interface to ensure they are correctly set, as incorrect or missing properties can lead to issues when opening the presentation in PowerPoint.

  4. Test with Different Versions: If possible, test your output with various versions of PowerPoint to determine if the issue is consistent across all versions or specific to PowerPoint 365.

  5. Review Output Format: Confirm that you are saving the presentation in a compatible format. If using SaveFormat.Pptx, ensure that all features utilized in the presentation are supported in that format.

  6. Check for Updates: Make sure you are using the latest version of Aspose.Slides, as updates often include bug fixes and enhancements.

Next Steps: If the issue persists after following these steps, please share a minimal reproducible example or specific slides that are causing the problem. This will assist in diagnosing the issue more effectively.

I hope this helps you resolve the issue! Please let me know if you need further assistance.

@ecodev,
Thank you for the sample presentation file. We need more details to investigate the case. Please share the following:

  • the code example to reproduce the problem
  • the Java version you are using
  • the Aspose.Slides version you are using

Hi Andrey!

Apologies for the delay, I wanted to narrow down the code responsible for the error due to our large code base. I’ve come to the conclusion that something is breaking when we duplicate any slide in the example template. Here’s some code I’ve tested that causes the issue:

@Test
void duplicateSlidesAndSaveToFile_requiresRepair() {
    try {
        presentation = new Presentation("template.pptx");
        File outputFile = Files.createTempFile("repair_needed", ".pptx").toFile();

        //   originally I thought these specific slides were causing the issue, but further testing revealed
        //   duplicating other slides causes the issues too
        //   presentation.getSlides().addClone(presentation.getSlides().get_Item(12));
        //   presentation.getSlides().addClone(presentation.getSlides().get_Item(1));
        //   presentation.getSlides().addClone(presentation.getSlides().get_Item(7));
        presentation.getSlides().addClone(presentation.getSlides().get_Item(1));

        String outputFilePath = "";
        try (FileOutputStream outputStream = new FileOutputStream(outputFile)) {
            outputFilePath = outputFile.getCanonicalPath();
            presentation.save(outputStream, SaveFormat.Pptx);
        } catch (IOException e) {
            throw new RuntimeException("Unable to write to slide show " + outputFilePath, e);
        }

    } catch (IOException e) {
        throw new RuntimeException(e);
    } finally {
        if (presentation != null) {
            presentation.dispose();
        }
    }
}

After generating the file, simply uploading said file to M365 and opening it displays the ‘Repair’ error.

Currently on Java 8 and Aspose 25.4. I’ve updated to Aspose 25.7 and still get the error.

@ecodev,
Thank you for the details. I have reproduced the repair message when executing the code example with Aspose.Slides for Java 25.4, but the issue disappeared when using version 25.7. I also tested cloning slides 7 and 12 that you mentioned in the code comments. Could you please check the isssue carefully again?

Hi Audrey!

You are right! It doesn’t seem to be happening anymore in the latest version of Aspose. I think last night my IDE didn’t properly reload the pom config. Thanks for noticing that I missed that.
One of my coworkers will verify other templates don’t need the repair issue anymore, but we can close this thread for now. I’ll update it should a similar issue arrive in 25.7

Thanks for your help & for the great product!

@ecodev,
Thank you for your feedback.