LayoutCollector class
LayoutCollector class
This class allows to compute page numbers of document nodes.
To learn more, visit the Converting to Fixed-page Format documentation article.
Remarks
When you create a LayoutCollector and specify a Document document object to attach to, the collector will record mapping of document nodes to layout objects when the document is formatted into pages.
You will be able to find out on which page a particular document node (e.g. run, paragraph or table cell) is located by using the LayoutCollector.getStartPageIndex(), LayoutCollector.getEndPageIndex() and LayoutCollector.getNumPagesSpanned() methods. These methods automatically build page layout model of the document and update fields if required.
When you no longer need to collect layout information, it is best to set the LayoutCollector.document property to null
to avoid unnecessary collection of more layout mappings.
Constructors
Name | Description |
---|---|
LayoutCollector(doc) | Initializes an instance of this class. |
Properties
Name | Description |
---|---|
document | Gets or sets the document this collector instance is attached to. |
Methods
Name | Description |
---|---|
clear() | Clears all collected layout data. Call this method after document was manually updated, or layout was rebuilt. |
getEndPageIndex(node) | Gets 1-based index of the page where node ends. Returns 0 if node cannot be mapped to a page. |
getNumPagesSpanned(node) | Gets number of pages the specified node spans. 0 if node is within a single page. This is the same as LayoutCollector.getEndPageIndex() - LayoutCollector.getStartPageIndex(). |
getStartPageIndex(node) | Gets 1-based index of the page where node begins. Returns 0 if node cannot be mapped to a page. |
See Also
- module Aspose.Words.Layout