We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to find if a section has page numbers or not?


I want to find page numbers of a section. For instance in a document there are 2 sections and in first section there are 11 pages and in second section there are 3 pages(Page no 12,13,14). Is there any way to find page numbers of second section?

Can you help me to find if a section has page numbers or not???

Thank you....


Thanks for your inquiry. Sure, you can achieve this using the following code snippet:

Document doc = new

LayoutCollector collector = new LayoutCollector(doc);

foreach(Section sec in doc.Sections){

Console.WriteLine("Section {0} starts at: {1}", doc.Sections.IndexOf(sec), collector.GetStartPageIndex(sec));

Console.WriteLine("Section {0} ends at: {1}", doc.Sections.IndexOf(sec), collector.GetEndPageIndex(sec));

Console.WriteLine("Section {0} spans across pages: {1}", doc.Sections.IndexOf(sec), collector.GetNumPagesSpanned(sec));



I hope, this helps.

Best regards,


Thank you for your reply but we are using and LayoutCollector class is not there in this version.

Please let me know how i find if a section contains page numbers or not using version of aspose.words.


Thanks for your inquiry. You are using a very old version and unfortunately, we don't provide support for older released versions of Aspose.Words. We always encourage our customers to use the latest version of Aspose.Words as it contains newly introduced features, enhancements and fixes to the issues that were reported earlier. So, I would suggest you please upgrade to the latest version of Aspose.Words for .NET (14.2.0). You can download it from the following link:

Best regards,