Fetching page number

codepage.PNG 

  I'm using syncfusion winforms word. How can I fetch the page count (Number) by using heading on each page. I have consider each page as a section in my code. And the above code I'm using for page number. I want to use this page number for my Index numbering.


1 Reply

AN Anto Nihil Sahaya Raj Syncfusion Team April 29, 2024 02:12 PM UTC

Hi Pushkar,

The Word document is a flow document in which contents (paragraphs, tables, etc.,) will not be preserved page by page; instead the contents will be preserved sequentially section by section. Word viewer/editor renders the contents of the Word document page by page dynamically when opened for viewing or editing. This page wise rendered information will not be preserved in the file level.

Syncfusion .NET Word library is a non-UI component that provides a full-fledged document object model to manipulate the Word document contents. Therefore, it is not feasible to fetch page numbers from a Word document using DocIO.

Alternatively, you can get the page number by following the steps below:

  1. Set the PAGE field in each section and keep each section as a separate page.

  2. Next, update the fields in the document programmatically using DocIO.

  3. Finally, locate the PAGE field and retrieve the updated result.

Please refer to our KB to know the steps to set the page numbers based on the above alternate solution  in a Word document,
Is it possible to fetch page numbers in a Word document using DocIO? | Syncfusion

A complete working sample to set page numbers in a Word documentt can be downloaded from 
GitHub.

Regards,
Anto Nihil S


Loader.
Up arrow icon