When using Aspose.Slides for Java (version 24.12 - also tried on the latest version 25.4) our team ran into an interesting issue. After cloning new slides to an existing presentation, when that presentation was opened in PowerPoint we would be prompted with the “PowerPoint can attempt to repair the presentation” pop-up dialog. In our case, this was reproducible when adding 86 slides (Adding 85 slides worked without issue).
After debugging this issue, we determined that the root cause was the Slide ID of the 86th slide we cloned, was a number greater than Integer.MAX_VALUE (2147483647). In Aspose, IBaseSlide has the slide ID property as a long, so there would be no issue from our code point of view. We believe, that the slide ID represented in PowerPoint is an Integer, which causes this corruption / repair issue. Please take a look at this comparison of the presentation.xml file:
image.png (11.6 KB)
The left side is a working PPTX file, with 85 slides generated. The right side is the non-working PPTX file with 86 slides generated.
I believe what is happening is Aspose is getting the next Slide ID by taking the highest current SlideId in the presentation, and just incrementing that number. There is no way to override this value. It would be nice if Aspose instead got the next Lowest Slide ID in the list, instead of the highest, or allow us some way to override this value by manipulating the slide ID values ourselves.
As to how the Slide IDs managed to get that high in the first place? We speculate that a Master Template Slide was cloned, which started an internal chain reaction of high slide ID values to be generated. We assume this, because creating a blank power point, the master slide ID will be a number generated close to Integer.MAX_VALUE.
As a work around in our code, we validate the SlideID of the slide we have cloned, and throw an error if it’s greater than Integer.MAX_VALUE. We also updated the original presentation.xml file in PPTX File manually, to lower all of the existing Slide IDs.