I am working on a simple web grammar add-in for MS Word. Basically, I want to get the selected text, make minimal changes and update the document with the corrected text. Currently, if I use βtextβ as a type of coercion, I am losing formatting. If there is a table or image in the selected text, they also disappeared!
As I understand it from the research I have done so far, openxml is the way to go. But I could not find a single useful example on the Internet. How can I manipulate text while preserving the original formatting data? How to ignore non-text paragraphs? I want to be able to do this using the Office JavaScript API:

source
share