in the application i'm developing i'm using a dsoframer to open a word 2007 document inside the application itself.
in adition to the document inside the dsoframer i have a WordprocessingDocument object of the same document.
what i need/want to do is to be able to find the position of a given part of the document in the WordprocessingDocument (and the other way around).
for example: if the user selected a word or phrase inside the document (dsoframer) i want to find the position of that word/phrase in the WordprocessingDocument (in the document.xml part of course).
is it possible to do it in a simple way?thanks, nitzan
I have a similar problem - I want to move through a document open in Word and access, display & possibly modify related Custom XML stored in the document Package based on document location. (Simple databinding won't work since the custom XML contains metadata related to the text rather than content.) To facilitate this, I have a utility that first wraps all top-level document.xml elements (paragraphs and tables) with RichText Content Controls (<sdt> tags); this allows the document to notify the associated add-in that it has entered or exited a certain region in the document via ContentControl.Enter and .Exit events (this would also point to the <sdt> object in the package). However, I can't have the document open both in Word (as a Document) and in the add-in (as a WordProcessingDocument package) at the same time in read-write mode (or can I?). One possible approach might be to copy the custom XML from the package to a temporary cache, use the cache in conjunction with the open Word document, then update the package with the modified cached custom XML after closing the document in Word.
This "principle of complementarity" - that the two document views are mutually orthogonal - is a quantum conundrum waiting for a good solution.