public class NodeType
extends java.lang.Object
Examples:
Shows how to traverse through a composite node's collection of child nodes.
Document doc = new Document();
// Add two runs and one shape as child nodes to the first paragraph of this document.
Paragraph paragraph = (Paragraph) doc.getChild(NodeType.PARAGRAPH, 0, true);
paragraph.appendChild(new Run(doc, "Hello world! "));
Shape shape = new Shape(doc, ShapeType.RECTANGLE);
shape.setWidth(200.0);
shape.setHeight(200.0);
// Note that the 'CustomNodeId' is not saved to an output file and exists only during the node lifetime.
shape.setCustomNodeId(100);
shape.setWrapType(WrapType.INLINE);
paragraph.appendChild(shape);
paragraph.appendChild(new Run(doc, "Hello again!"));
// Iterate through the paragraph's collection of immediate children,
// and print any runs or shapes that we find within.
NodeCollection children = paragraph.getChildNodes(NodeType.ANY, false);
Assert.assertEquals(3, paragraph.getChildNodes(NodeType.ANY, false).getCount());
for (Node child : (Iterable<Node>) children)
switch (child.getNodeType()) {
case NodeType.RUN:
System.out.println("Run contents:");
System.out.println(MessageFormat.format("\t\"{0}\"", child.getText().trim()));
break;
case NodeType.SHAPE:
Shape childShape = (Shape)child;
System.out.println("Shape:");
System.out.println(MessageFormat.format("\t{0}, {1}x{2}", childShape.getShapeType(), childShape.getWidth(), childShape.getHeight()));
break;
}
| Modifier and Type | Field and Description |
|---|---|
static int |
ANY
Indicates all node types.
|
static int |
BODY
A
Body object that contains the main text of a section (main text story). |
static int |
BOOKMARK_END
An end of a bookmark marker.
|
static int |
BOOKMARK_START
A beginning of a bookmark marker.
|
static int |
BUILDING_BLOCK
A building block within a glossary document (e.g.
|
static int |
CELL
A cell of a table row.
|
static int |
COMMENT
A comment in a Word document.
|
static int |
COMMENT_RANGE_END
A marker node that represents the end of a commented range.
|
static int |
COMMENT_RANGE_START
A marker node that represents the start of a commented range.
|
static int |
DOCUMENT
A
Document object that, as the root of the document tree, provides access to the entire Word document. |
static int |
EDITABLE_RANGE_END
An end of an editable range.
|
static int |
EDITABLE_RANGE_START
A beginning of an editable range.
|
static int |
FIELD_END
A special character that designates the end of a Word field.
|
static int |
FIELD_SEPARATOR
A special character that separates the field code from the field result.
|
static int |
FIELD_START
A special character that designates the start of a Word field.
|
static int |
FOOTNOTE
A footnote or endnote in a Word document.
|
static int |
FORM_FIELD
A form field.
|
static int |
GLOSSARY_DOCUMENT
A glossary document within the main document.
|
static int |
GROUP_SHAPE
A group of shapes, images, OLE objects or other group shapes.
|
static int |
HEADER_FOOTER
A
HeaderFooter object that contains text of a particular header or footer inside a section. |
static int |
length |
static int |
MOVE_FROM_RANGE_END
An end of an MoveFrom range.
|
static int |
MOVE_FROM_RANGE_START
A beginning of an MoveFrom range.
|
static int |
MOVE_TO_RANGE_END
An end of an MoveTo range.
|
static int |
MOVE_TO_RANGE_START
A beginning of an MoveTo range.
|
static int |
NULL
Reserved for internal use by Aspose.Words.
|
static int |
OFFICE_MATH
An Office Math object.
|
static int |
PARAGRAPH
A paragraph of text.
|
static int |
ROW
A row of a table.
|
static int |
RUN
A run of text.
|
static int |
SECTION
A
Section object that corresponds to one section in a Word document. |
static int |
SHAPE
A drawing object, such as an OfficeArt shape, image or an OLE object.
|
static int |
SMART_TAG
A smart tag around one or more inline structures (runs, images, fields,etc.) within a paragraph
|
static int |
SPECIAL_CHAR
A special character that is not one of the more specific special character types.
|
static int |
STRUCTURED_DOCUMENT_TAG
Allows to define customer-specific information and its means of presentation.
|
static int |
STRUCTURED_DOCUMENT_TAG_RANGE_END
A end of ranged structured document tag which accepts multi-sections content.
|
static int |
STRUCTURED_DOCUMENT_TAG_RANGE_START
A start of ranged structured document tag which accepts multi-sections content.
|
static int |
SUB_DOCUMENT
A subdocument node which is a link to another document.
|
static int |
SYSTEM
Reserved for internal use by Aspose.Words.
|
static int |
TABLE
A
Table object that represents a table in a Word document. |
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String nodeTypeName) |
static java.lang.String |
getName(int nodeType) |
static int[] |
getValues() |
static java.lang.String |
toString(int nodeType) |
public static int ANY
public static int DOCUMENT
public static int SECTION
A Section object that corresponds to one section in a Word document.
A Section node can have Body and HeaderFooter nodes.
public static int BODY
public static int HEADER_FOOTER
A HeaderFooter object that contains text of a particular header or footer inside a section.
A HeaderFooter node can have Paragraph and Table nodes.
public static int TABLE
public static int ROW
public static int CELL
public static int PARAGRAPH
A paragraph of text.
A Paragraph node is a container for inline level elements Run, FieldStart, FieldSeparator, FieldEnd, FormField, Shape, GroupShape, Footnote, Comment, SpecialChar, as well as BookmarkStart and BookmarkEnd.
public static int BOOKMARK_START
A beginning of a bookmark marker.
public static int BOOKMARK_END
An end of a bookmark marker.
public static int EDITABLE_RANGE_START
A beginning of an editable range.
public static int EDITABLE_RANGE_END
An end of an editable range.
public static int MOVE_FROM_RANGE_START
A beginning of an MoveFrom range.
public static int MOVE_FROM_RANGE_END
An end of an MoveFrom range.
public static int MOVE_TO_RANGE_START
A beginning of an MoveTo range.
public static int MOVE_TO_RANGE_END
An end of an MoveTo range.
public static int GROUP_SHAPE
A group of shapes, images, OLE objects or other group shapes.
A GroupShape node can contain other Shape and GroupShape nodes.
public static int SHAPE
public static int COMMENT
public static int FOOTNOTE
public static int RUN
A run of text.
public static int FIELD_START
A special character that designates the start of a Word field.
public static int FIELD_SEPARATOR
A special character that separates the field code from the field result.
public static int FIELD_END
A special character that designates the end of a Word field.
public static int FORM_FIELD
A form field.
public static int SPECIAL_CHAR
A special character that is not one of the more specific special character types.
public static int SMART_TAG
A smart tag around one or more inline structures (runs, images, fields,etc.) within a paragraph
public static int STRUCTURED_DOCUMENT_TAG
Allows to define customer-specific information and its means of presentation.
public static int STRUCTURED_DOCUMENT_TAG_RANGE_START
A start of ranged structured document tag which accepts multi-sections content.
public static int STRUCTURED_DOCUMENT_TAG_RANGE_END
A end of ranged structured document tag which accepts multi-sections content.
public static int GLOSSARY_DOCUMENT
A glossary document within the main document.
public static int BUILDING_BLOCK
A building block within a glossary document (e.g. glossary document entry).
public static int COMMENT_RANGE_START
public static int COMMENT_RANGE_END
public static int OFFICE_MATH
An Office Math object. Can be equation, function, matrix or one of other mathematical objects. Can be a collection of mathematical object and also can contain some non-mathematical objects such as runs of text.
public static int SUB_DOCUMENT
public static int SYSTEM
public static int NULL
public static int length