
Keeping track of pasted text?
I have a module that converts some equation objects in a Word document
to a text format like MathML or LaTeX. I loop through the equations in
the document, call a function from a DLL to put the converted text on
the clipboard, and then paste it into the document.
Here's the problem: after doing some operations on the document, I
need to restore it as it was before I put in the pasted text. Making a
copy of the document and reverting to it is not an option for me. So
what I need to be able to do is to keep track of the ranges of all my
pasted text so that I can simply do Range.Delete later on. How would I
do this? Right now I am just pasting the text near the appropriate
equation, but I have no idea as to how I can get the pasted text's
range.
Is there a way to keep track of where exactly pasted text has been
inserted into a document?