none
How to retrieve page no. corresponding to a paragraph RRS feed

  • Question

  • Hi All,

    I am able to retrieve paragraph or style  from a word doc based on the article,

    http://msdn.microsoft.com/en-us/library/bb669175.aspx.

    But, I need to know also the corresponding page no. on which the paragraph exists. For examle, I am searching for some paragraph in a document, the shared article helps to extract/verify if the paragraph exists or not. Could you please help me to know the page no. on which the found paragraph exists?

    Thanks & Regards,

    Vikash

     

    Thursday, October 14, 2010 12:43 PM

All replies

  • Use the .Information(wdActiveEndPageNumber) to get the page number of the .Range of the paragraph.

    -- Hope this helps.

    Doug Robbins - Word MVP,
    dkr[atsymbol]mvps[dot]org
    Posted via the Community Bridge

    "Vikash_me" wrote in message news:7742afbe-7e01-451a-96b5-37ef14a00a2d@communitybridge.codeplex.com...

    Hi All,

    I am able to retrieve paragraph or style  from a word doc based on the article,

    http://msdn.microsoft.com/en-us/library/bb669175.aspx.

    But, I need to know also the corresponding page no. on which the paragraph exists. For examle, I am searching for some paragraph in a document, the shared article helps to extract/verify if the paragraph exists or not. Could you please help me to know the page no. on which the found paragraph exists?

    Thanks & Regards,

    Vikash


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Thursday, October 14, 2010 11:27 PM
  • Hi Doug,

    Thanks for the response. But, I am afraid if I can use this.

    Actally, I am using open XML in VB.net to extract a paragraph and hence need something that can work with open XML.

     

    Thanks,

    Vikash

     

    Sunday, October 17, 2010 6:29 PM
  • Hi Vikash

    I'm going to move your question to the OpenXML forum.

    FWIW, I don't think this is possible with the closed file, but OpenXML might store something. Generally, however, Word lays out a document dynamically. Line and page breaks change fluidly, as the user edits the document. There is therefore no such thing as a "line" object and the only items the Page object offers in the object model have to do with the static, graphical layout of the page. The Page object can't even give you a page number...

    But, as I say, the OpenXML specialists should be able to tell you if what you want to do is even possible...


    Cindy Meister, VSTO/Word MVP
    Sunday, October 17, 2010 7:44 PM
    Moderator