Wrapping OOXML APIs Needed - insertComment, insertBookmark, insertOoxmlFragment
The API makes it very very difficult to wrap content in the underlying OOXML with additional OOXML.
SUGGESTION: It would be great if there were a range.insertComment, range.insertBookmark that worked exactly like range.insertContentControl does! Or please give us a method to get the current OOXML fragment represented by a range. I'm trying to insert bookmarks and I've seen others trying to insert comments, around the selected text. The getOoxml() methods are great if you're writing copy/paste functionality, but that doesn't help you if you're trying to manipulate/wrap the fragment.
Ron, thanks for your suggestions. We’re currently reviewing these ideas. We’ll keep you posted with updates.
Also, please note that we do have an API to get the OOXML of a range. Check out dev.office.com for more info.
Office Extensibility Team
Koen Driessen commented
Any updates on this?
Agree that this needs to be core - particularly insertComment and insertBookmark.
The ooxml workaround (my term for it) is actually okay for me...except I can't insert anything but plain text into a Comment. I can't programmatically add to the comments.xml.rel file, necessary to create a link to match XML added to Comments.xml.
This was core VBA/VB capability for a long time...please consider prioritizing for Office.js. Thank you.
Ron Jones commented
This really needs to be in the core office.js api. Here's some code that creates bookmarks that shows why. https://wordaddinbookmarksample.codeplex.com/