none
How to get the text in a word document? RRS feed

  • Question

  • Hello,

    How can I get the entire text in a word document using office automation? What properties and methods would I need to be able to get the whole document text? Is there something like ActiveDocument.Text or something which serves a similar purpose?

    I would appreciate a prompt response.

    Thanks a lot.

    Regards.

    Tuesday, September 6, 2011 1:22 AM

Answers

  • Hello,

    See Document.Content and also Document.StoryRanges.


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    • Marked as answer by ShadowXZ Wednesday, September 7, 2011 1:34 AM
    Tuesday, September 6, 2011 5:32 AM

All replies

  • Hello,

    See Document.Content and also Document.StoryRanges.


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    • Marked as answer by ShadowXZ Wednesday, September 7, 2011 1:34 AM
    Tuesday, September 6, 2011 5:32 AM
  • Hi Shadow

    There are various possibilities, but the optimal one will depend on what it is you want to do with the result.

    When you say "all" the text, do you also include things like headers, footers, text in graphics objects? How about text not visible on the document surface, such as properties?

    Which version of Word are we talking about?


    Cindy Meister, VSTO/Word MVP
    Tuesday, September 6, 2011 7:01 AM
    Moderator
  • Hi Cindy,

    I'm talking about Word 2010.

    And by "all" I specifically mean the text in the document itself, not headers, footers or graphics.

    Thanks.

    Tuesday, September 6, 2011 3:49 PM