Best Way to Navigate to a MS Word Paragraph from TreeView in ADX Task Pane

Add-in Express™ Support Service
That's what is more important than anything else

Best Way to Navigate to a MS Word Paragraph from TreeView in ADX Task Pane
Jeremy McClanathan

Posts: 20
Joined: 2017-02-09
I have an add-in that needs to mimic the navigation portion of the ms word navigation pane. I.E. it needs to display the paragraphs which have styles with outline levels applied in an outline format and navigate to the appropriate paragraph when clicked. Currently I have a treeview on an advanced task pane where I copy text from paragraphs with outline levels applied. The next step is to program the ability to navigate to the appropriate paragraph in Word when a treeview node on the task pane is clicked. My question is, what is the best strategy to navigate to the appropriate Word paragraph when a treeview node is clicked? I could take the text in the treeview node and search for the text in the Word document, then navigate to the paragraph where the text is found. But, that seems clunky and there could be paragraphs with the same text, so the search could return the wrong result. Is there a better way to accomplish this navigation when a treenode is clicked? Maybe some way to reference a paragraph instead of copying the text?
Posted 11 Dec, 2018 00:43:40 Top
Andrei Smolin

Add-in Express team

Posts: 15595
Joined: 2006-05-11
Hello Jeremy,

Consider using Paragraph.Range.Start as an identifier of a paragraph. Also, I suggest using Paragraph.Next() when creating a list of paragraphs instead of using for each. As to navigating to a paragraph, see

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 11 Dec, 2018 02:09:40 Top