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?

Hi,

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....

Hi,


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

Document doc = new
Document(@“C:\Temp\input.docx”);

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));

Console.WriteLine("------------------");

}


I hope, this helps.

Best regards,

Hi,

Thank you for your reply but we are using 10.8.0.0 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 10.8.0.0 version of aspose.words.

Hi,

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:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

Best regards,