Hi Günther Grill | headwAI GmbH
Thank you for reaching out via the Microsoft Q&A forum and sharing your add-in scenario and the issue you encountered with undo behavior in Word Online when using insertOoxml.
I’ve been looking into the undo issue you mentioned when using insertOoxml in Word Online, and I think the behavior might be tied to how Word Online handles document updates compared to Word Desktop.
From what I’ve seen, Word Online doesn’t fully reflect the rich editing behaviors of the desktop app. Some features available on Desktop, like certain field types or content controls, don’t behave the same way or are missing entirely in the web version. So it’s possible that this difference in platform capabilities is also why the undo stack behaves differently when inserting OOXML.
Also, when I read through Microsoft’s official documentation, I noticed they list OOXML insertion last among the recommended methods for Word add-ins, with the note:
So maybe the takeaway here is: for small edits, it’s better to stick with the standard Word JS APIs (like insertText, insertHtml) which preserve undo behavior across platforms. And only use insertOoxml when you really need to insert something complex, but with the understanding that undo won’t be available in Word Online.
Some users seem to work around this by enabling Track Changes before inserting OOXML, so they can reject the change later. Others rely on version history in OneDrive or SharePoint to restore the document if needed. These aren’t perfect solutions, but they might help in cases where undo is important.
Hope this info is helpful.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread