Jump to Page?

Hi All,

How can I position the start point of an opened existing document to a specific page ?. So once I have opened the document I want to jump straight to page N . and start processing from there ?

Regards,
Sam

Hi Sam,

Thanks for your inquiry. Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have logged this feature request as WORDSNET-14136 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

Hi Sam,

Further to my last post, you can move the cursor to the first node of a page and insert contents according to your requirements. Please check the following code example. Hope this helps you.

Document doc = new Document(MyDir + "in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
Node node = GetNodeByPageNumber(2, doc);
builder.MoveTo(node);
builder.Writeln("Aspose.Words for .NET");
doc.Save(MyDir + "Out.docx");
private static Node GetNodeByPageNumber(int page, Document document)
{
    LayoutCollector lc = new LayoutCollector(document);
    foreach (Section section in document.Sections)
    {
        foreach (Node node in section.Body.ChildNodes)
        {
            if (lc.GetStartPageIndex(node) == page)
                return node;
        }
    }
    return null;
}

Hi Sam,

Regarding WORDSNET-14136, it is to update you that this feature has closed with “Won’t Fix” resolution.

You can achieve your requirements using Aspose.Words.Layout APIs as shown in my previous post. LayoutEnumerator enumerates page layout entities of a document. Please use this class to walk over the page layout model. The available properties are type, geometry, text and page index where entity is rendered, as well as overall structure and relationships.