none
Adding custom comments to Word document RRS feed

  • Question

  • What is the canonical way of associating some user-generated text with a selection in a Word document? What I need is very similar to Word comments, except I do not want these to be comments.
    I further process my docs with OpenXML to extract the content, this is how I plan to use these pieces.
    Thursday, November 8, 2012 5:18 PM

Answers

  • Hi Alex

    Word provides no other way than what you list (plus footnotes) to associate text with a range. There is no "hidden container" a developer may use.

    The only possiblity that occurs to me is that you mark the text in someway (a bookmark, perhaps) and then associate the additional data with that. You could, for example, insert a Custom XML Part in the document and use that to track bookmark + data combinations.


    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, November 10, 2012 8:01 AM
    Moderator
  • Hi VSTO Developer

    Strictly speaking, there is no such thing as a "custom part" in Word. I'm assuming you mean a Custom XML Part? These can be associated directly only with content controls, which means you'd have to place the text in question into a content control.


    Cindy Meister, VSTO/Word MVP, my blog

    Monday, November 12, 2012 5:21 PM
    Moderator

All replies

  • Hi vsto_develper,

    Thanks for posting in the MSDN Forum.

    Would you please show me more detailed scenario for your goal?

    What is the canonical way of associating some user-generated text with a selection in a Word document

    I think I can't understand the meaning of this. Do you want to prompt something like alert dialog to show some suggestion for the content which your select?

    What I need is very similar to Word comments, except I do not want these to be comments.

    I think it will help me to understand your will if you can show me a screen shooting in the post.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Friday, November 9, 2012 6:18 AM
    Moderator
  • I want the users to select some text, click my custom button, fill out the form I pop up and save. The data I save should be associated with the range selected. This is similar to how hyperlinks, comments and endnotes work. 

    Thank you,

    Alex

    Friday, November 9, 2012 1:02 PM
  • Hi Alex

    Word provides no other way than what you list (plus footnotes) to associate text with a range. There is no "hidden container" a developer may use.

    The only possiblity that occurs to me is that you mark the text in someway (a bookmark, perhaps) and then associate the additional data with that. You could, for example, insert a Custom XML Part in the document and use that to track bookmark + data combinations.


    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, November 10, 2012 8:01 AM
    Moderator
  • Thank you, Cindy.
    I should look at bookmarks too. All examples that have been mentioned are organized using custom parts. Is there no way to associate a custom part with an arbitrary element?
    Monday, November 12, 2012 3:10 PM
  • Hi VSTO Developer

    Strictly speaking, there is no such thing as a "custom part" in Word. I'm assuming you mean a Custom XML Part? These can be associated directly only with content controls, which means you'd have to place the text in question into a content control.


    Cindy Meister, VSTO/Word MVP, my blog

    Monday, November 12, 2012 5:21 PM
    Moderator