Free Support Forum - aspose.com

Need a way to read page breaks

Hi,

I require to read a portion of a word document after leaving behind a first few pages.How should i demarcate my word document (by page breaks).

Presently i use a class implementing DocumentVisitor, which implements the visitParagraphStart method to read info from the paragraphs. And i require to know before i start reading the content, that i am past the first -n-pages or not (based on if i am able to read page breaks).

regards
vivek bahl

You cannot read section breaks directly. You will know that the section break was encounered when DocumentVisitor.VisitSectionStart will be called.

Page breaks can be checked for in DocumentVisitor.VisitRun. For example,

public override VisitorAction VisitRun(Run run)

{

if (run.Text.IndexOfAny(new char[] {ControlChar.PageBreakChar}) >=0)

{

// page break is encountered

}

return VisitorAction.Continue;

}

Hope this helps.