none
How to retrieve page number 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:40 PM

Answers

  • I am not familiar with the SDK to be able to tell you how to do it, but I'm sure it can be done.
     
    If it helps any, the basic xml for a paragraph looks like this:
     
    <w:p>
      this is your paragraph
      <w:pPr>
        paragraph properties here
      </w:pPr>
      <w:r>
        <w:t>
          some text
        </w:t>
      </w:r>
    </w:p>
     
    Clearly there could be much more of it. To add a background colour to the paragraph, you use the <w:shd> tag, which goes inside the <w:pPr> tag (which may or may not be present to begin with).
     

    Enjoy,
    Tony
    www.WordArticles.com
    • Marked as answer by Bessie Zhao Thursday, October 21, 2010 9:43 AM
    Monday, October 18, 2010 6:37 AM

All replies

  • Word does not really work with units of pages; they are a facet of the combination of document content with the active printer. As you do not have printer information when using the SDK, you can not know what any page number will be. As far as I know, no information about 'soft' page breaks is held in the document, and you will not be able to do this.
     

    Enjoy,
    Tony
    www.WordArticles.com
    Sunday, October 17, 2010 3:55 PM
  • Hi Tony,

    Thanks for your clarification. But, I need to do something to identify a page where the searched paragraph exists. I have another idea to edit the target paragraph, I mean if I can give background colour for the target paragraph. It will complete my purpose to identify the page.

    What is your opinion? or do you have some better idea?

    Thanks & Regards,

    Vikash

     

     

    Sunday, October 17, 2010 6:25 PM
  • I am not familiar with the SDK to be able to tell you how to do it, but I'm sure it can be done.
     
    If it helps any, the basic xml for a paragraph looks like this:
     
    <w:p>
      this is your paragraph
      <w:pPr>
        paragraph properties here
      </w:pPr>
      <w:r>
        <w:t>
          some text
        </w:t>
      </w:r>
    </w:p>
     
    Clearly there could be much more of it. To add a background colour to the paragraph, you use the <w:shd> tag, which goes inside the <w:pPr> tag (which may or may not be present to begin with).
     

    Enjoy,
    Tony
    www.WordArticles.com
    • Marked as answer by Bessie Zhao Thursday, October 21, 2010 9:43 AM
    Monday, October 18, 2010 6:37 AM