I have a simple word add-on which I use to paste a sequence of strings into different places of a Microsoft Word document.
Currently I am using these lines of code, to get the information about the position:
int PageNumber = range.get_Information(WdInformation.wdActiveEndPageNumber);
int ColumnNumber = range.get_Information(WdInformation.wdFirstCharacterColumnNumber);
int LineNumber = range.get_Information(WdInformation.wdFirstCharacterLineNumber);
I need a way to track their place dynamically. Let’s say if user paste a name somewhere, and then our user decides to change the contents of document before this pasted name.
Do I need to parse the entire document to find my pasted string?
What if it’s a common string value like “Hello”? Can I hide or attach something to my pasted string dynamically? Like a pointer to specific string in document?
I appreciate any help or idea, thanks.
As per the comments above it sounds like bookmarks provide what you need. Bookmarks can be hidden – to do that (IIRC) you need to give them a name that begins with an underscore. If you want to iterate over your hidden bookmarks later on then you need to set
beforehand.