com.aspose.words
Class LayoutEnumerator

java.lang.Object
    extended by com.aspose.words.LayoutEnumerator

public class LayoutEnumerator 
extends java.lang.Object

Enumerates page layout entities of a document. You can use this class to walk over page layout model. Available are type, geometry, text and page index where entity is rendered, as well as overall structure and relationships. Use moveNode(com.aspose.words.Node) method to locate entity which corresponds to a document node.

Constructor Summary
LayoutEnumerator(Document document)
           Initializes new instance of this class.
 
Property Getters/Setters Summary
java.lang.ObjectgetCurrent()
voidsetCurrent(java.lang.Object value)
           Gets or sets current position in the page layout model. This property return opaque object that caller can put on the stack to get back to it later.
java.lang.StringgetKind()
           Gets kind of the current entity. This cannot be null.
intgetPageIndex()
           Gets 1-based index of a page where current entity is.
java.awt.geom.Rectangle2D.FloatgetRectangle()
           Returns bounding rectangle of the current entity relative to the page top left corner (points).
java.lang.StringgetText()
           Gets text of the current span entity. Throws for other entity types.
intgetType()
           Gets type of the current entity. The value of the property is LayoutEntityType integer constant.
 
Method Summary
booleanmoveFirstChild()
           Moves to the first child entity.
booleanmoveLastChild()
           Moves to the last child entity.
booleanmoveNext()
           Moves to the next sibling entity.
booleanmoveNode(Node node)
           Moves to the layout entity corresponding to the specified Node.
booleanmoveParent()
           Moves to the parent entity.
booleanmoveParent(int types)
           Moves to the parent entity of the specified type.
booleanmovePrevious()
           Moves to the previous sibling entity.
voidreset()
           Moves enumerator to the first page of the document.
 

Constructor Detail

LayoutEnumerator

public LayoutEnumerator(Document document)
                 throws java.lang.Exception
Initializes new instance of this class.

If page layout model of the document hasn't been built enumerator calls Document.updatePageLayout() to build it.

Whenever document is updated and new page layout model is created for it new enumerator must be used to access it.

Parameters:
document - A document whose page layout model to enumerate.

Property Getters/Setters Detail

getCurrent/setCurrent

public java.lang.Object getCurrent() / public void setCurrent(java.lang.Object value)
Gets or sets current position in the page layout model. This property return opaque object that caller can put on the stack to get back to it later.

getKind

public java.lang.String getKind()
Gets kind of the current entity. This cannot be null. This is more specific type of the current entity, e.g. bookmark span has LayoutEntityType.SPAN type and may have either BOOKMARKSTART or BOOKMARKEND kind.

getPageIndex

public int getPageIndex()
Gets 1-based index of a page where current entity is.

getRectangle

public java.awt.geom.Rectangle2D.Float getRectangle()
Returns bounding rectangle of the current entity relative to the page top left corner (points).

getText

public java.lang.String getText()
Gets text of the current span entity. Throws for other entity types.

getType

public int getType()
Gets type of the current entity. The value of the property is LayoutEntityType integer constant.

Method Detail

moveFirstChild

public boolean moveFirstChild()
                      throws java.lang.Exception
Moves to the first child entity.

moveLastChild

public boolean moveLastChild()
Moves to the last child entity.

moveNext

public boolean moveNext()
                throws java.lang.Exception
Moves to the next sibling entity.

moveNode

public boolean moveNode(Node node)
Moves to the layout entity corresponding to the specified Node.

Only Paragraph, Cell, Row and inline level nodes may have corresponding entities in the page layout model, and only if they are actually rendered on a page. The corresponding layout entity type is LayoutEntityType.SPAN.


moveParent

public boolean moveParent()
Moves to the parent entity.

moveParent

public boolean moveParent(int types)
Moves to the parent entity of the specified type. This method is useful if you need to find cell, column or header/footer parent of the entity.
Parameters:
types - A LayoutEntityType value. -OR-ed types.

movePrevious

public boolean movePrevious()
                    throws java.lang.Exception
Moves to the previous sibling entity.

reset

public void reset()
          throws java.lang.Exception
Moves enumerator to the first page of the document.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.