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 All,
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;
}