I am developing a PowerPoint add-in wherein there is a functionality of adding a slide using the base64 string and the method insertSlidesFromBase64. Below is the code for the same:
await PowerPoint.run(async (context) => {
context.presentation.insertSlidesFromBase64(pptContent, {
targetSlideId: `${selectedSlideID}#`,
formatting: PowerPoint.InsertSlideFormatting.useDestinationTheme,
});
await context.sync();
});
Here "selectedSlideID" is the unique id of the slide after which this slide needs to be inserted. When I am inserting, say, 3 slides using this method and then press undo button (or Ctrl +Z) all 3 slides disappear together. However, the expectation is that if we are inserting 3 slides then these are 3 separate actions and an undo command should remove only the last inserted slide. This is happening even if the Autosave feature is ON and also if we save the file where the slides are being inserted. Can you tell me why it is happening and if there is a fix for it?
context.syncbetween each of them and then see how undo behaves after they are all inserted.