title: How to access OpenXML content by page number?
body: <p>Using OpenXML, can I read the document content by page number?</p>
  
  <p><code>wordDocument.MainDocumentPart.Document.Body</code> gives content of full document.</p>
  
  <pre><code>  public void OpenWordprocessingDocumentReadonly()
          {
              string filepath = @"C:\...\test.docx";
              // Open a WordprocessingDocument based on a filepath.
              using (WordprocessingDocument wordDocument =
                  WordprocessingDocument.Open(filepath, false))
              {
                  // Assign a reference to the existing document body.  
                  Body body = wordDocument.MainDocumentPart.Document.Body;
                  int pageCount = 0;
                  if (wordDocument.ExtendedFilePropertiesPart.Properties.Pages.Text != null)
                  {
                      pageCount = Convert.ToInt32(wordDocument.ExtendedFilePropertiesPart.Properties.Pages.Text);
                  }
                  for (int i = 1; i &lt;= pageCount; i++)
                  {
                      //Read the content by page number
                  }
              }
          }
  </code></pre>
  
  <p><strong>MSDN <a href="https://msdn.microsoft.com/en-us/library/office/ff478541.aspx">Reference</a></strong></p>
  
  <hr>
  
  <p><strong>Update 1:</strong></p>
  
  <p>it looks like page breaks are set as below</p>
  
  <pre><code>&lt;w:p w:rsidR="003328B0" w:rsidRDefault="003328B0"&gt;
          &lt;w:r&gt;
              &lt;w:br w:type="page" /&gt;
          &lt;/w:r&gt;
      &lt;/w:p&gt;
  </code></pre>
  
  <p>So now I need to split the XML with above check and take <code>InnerTex</code> for each, that will give me page vise text.</p>
  
  <p>Now question becomes how can I split the XML with above check?</p>
  
  <hr>
  
  <p><strong>Update 2:</strong></p>
  
  <p>Page breaks are set only when you have page breaks, but if text is floating from one page to other pages, then there is no page break XML element is set, so it revert back to same challenge how o identify the page separations.</p>