java.lang.Object
com.aspose.words.NodeType
public class NodeType
Example:
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;
}
| Field Summary | ||
|---|---|---|
static final int | ANY | |
| Indicates all node types. Allows to select all children. | ||
static final int | DOCUMENT | |
| A |
||
static final int | SECTION | |
| A A |
||
static final int | BODY | |
| A |
||
static final int | HEADER_FOOTER | |
| A A |
||
static final int | TABLE | |
| A |
||
static final int | ROW | |
| A row of a table. |
||
static final int | CELL | |
| A cell of a table row. |
||
static final int | PARAGRAPH | |
| A paragraph of text. A |
||
static final int | BOOKMARK_START | |
| A beginning of a bookmark marker. |
||
static final int | BOOKMARK_END | |
| An end of a bookmark marker. |
||
static final int | EDITABLE_RANGE_START | |
| A beginning of an editable range. |
||
static final int | EDITABLE_RANGE_END | |
| An end of an editable range. |
||
static final int | MOVE_FROM_RANGE_START | |
| A beginning of an MoveFrom range. |
||
static final int | MOVE_FROM_RANGE_END | |
| An end of an MoveFrom range. |
||
static final int | MOVE_TO_RANGE_START | |
| A beginning of an MoveTo range. |
||
static final int | MOVE_TO_RANGE_END | |
| An end of an MoveTo range. |
||
static final int | GROUP_SHAPE | |
| A group of shapes, images, OLE objects or other group shapes. A |
||
static final int | SHAPE | |
| A drawing object, such as an OfficeArt shape, image or an OLE object. |
||
static final int | COMMENT | |
| A comment in a Word document. |
||
static final int | FOOTNOTE | |
| A footnote or endnote in a Word document. |
||
static final int | RUN | |
| A run of text. |
||
static final int | FIELD_START | |
| A special character that designates the start of a Word field. |
||
static final int | FIELD_SEPARATOR | |
| A special character that separates the field code from the field result. |
||
static final int | FIELD_END | |
| A special character that designates the end of a Word field. |
||
static final int | FORM_FIELD | |
| A form field. |
||
static final int | SPECIAL_CHAR | |
| A special character that is not one of the more specific special character types. |
||
static final int | SMART_TAG | |
| A smart tag around one or more inline structures (runs, images, fields,etc.) within a paragraph |
||
static final int | STRUCTURED_DOCUMENT_TAG | |
| Allows to define customer-specific information and its means of presentation. |
||
static final int | STRUCTURED_DOCUMENT_TAG_RANGE_START | |
| A start of ranged structured document tag which accepts multi-sections content. |
||
static final int | STRUCTURED_DOCUMENT_TAG_RANGE_END | |
| A end of ranged structured document tag which accepts multi-sections content. |
||
static final int | GLOSSARY_DOCUMENT | |
| A glossary document within the main document. |
||
static final int | BUILDING_BLOCK | |
| A building block within a glossary document (e.g. glossary document entry). |
||
static final int | COMMENT_RANGE_START | |
| A marker node that represents the start of a commented range. | ||
static final int | COMMENT_RANGE_END | |
| A marker node that represents the end of a commented range. | ||
static final 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. |
||
static final int | SUB_DOCUMENT | |
| A subdocument node which is a link to another document. | ||
static final int | SYSTEM | |
| Reserved for internal use by Aspose.Words. | ||
static final int | NULL | |
| Reserved for internal use by Aspose.Words. | ||
| Field Detail |
|---|
ANY = 0 | |
public static final int ANY | |
DOCUMENT = 1 | |
public static final int DOCUMENT | |
A
SECTION = 2 | |
public static final int SECTION | |
A
A
BODY = 3 | |
public static final int BODY | |
A
HEADER_FOOTER = 4 | |
public static final int HEADER_FOOTER | |
A
A
TABLE = 5 | |
public static final int TABLE | |
ROW = 6 | |
public static final int ROW | |
CELL = 7 | |
public static final int CELL | |
PARAGRAPH = 8 | |
public static final int PARAGRAPH | |
A paragraph of text.
A
BOOKMARK_START = 9 | |
public static final int BOOKMARK_START | |
A beginning of a bookmark marker.
BOOKMARK_END = 10 | |
public static final int BOOKMARK_END | |
An end of a bookmark marker.
EDITABLE_RANGE_START = 11 | |
public static final int EDITABLE_RANGE_START | |
A beginning of an editable range.
EDITABLE_RANGE_END = 12 | |
public static final int EDITABLE_RANGE_END | |
An end of an editable range.
MOVE_FROM_RANGE_START = 13 | |
public static final int MOVE_FROM_RANGE_START | |
A beginning of an MoveFrom range.
MOVE_FROM_RANGE_END = 14 | |
public static final int MOVE_FROM_RANGE_END | |
An end of an MoveFrom range.
MOVE_TO_RANGE_START = 15 | |
public static final int MOVE_TO_RANGE_START | |
A beginning of an MoveTo range.
MOVE_TO_RANGE_END = 16 | |
public static final int MOVE_TO_RANGE_END | |
An end of an MoveTo range.
GROUP_SHAPE = 17 | |
public static final int GROUP_SHAPE | |
A group of shapes, images, OLE objects or other group shapes.
A
SHAPE = 18 | |
public static final int SHAPE | |
A drawing object, such as an OfficeArt shape, image or an OLE object.
COMMENT = 19 | |
public static final int COMMENT | |
FOOTNOTE = 20 | |
public static final int FOOTNOTE | |
RUN = 21 | |
public static final int RUN | |
A run of text.
FIELD_START = 22 | |
public static final int FIELD_START | |
A special character that designates the start of a Word field.
FIELD_SEPARATOR = 23 | |
public static final int FIELD_SEPARATOR | |
A special character that separates the field code from the field result.
FIELD_END = 24 | |
public static final int FIELD_END | |
A special character that designates the end of a Word field.
FORM_FIELD = 25 | |
public static final int FORM_FIELD | |
A form field.
SPECIAL_CHAR = 26 | |
public static final int SPECIAL_CHAR | |
A special character that is not one of the more specific special character types.
SMART_TAG = 27 | |
public static final int SMART_TAG | |
A smart tag around one or more inline structures (runs, images, fields,etc.) within a paragraph
STRUCTURED_DOCUMENT_TAG = 28 | |
public static final int STRUCTURED_DOCUMENT_TAG | |
Allows to define customer-specific information and its means of presentation.
STRUCTURED_DOCUMENT_TAG_RANGE_START = 29 | |
public static final int STRUCTURED_DOCUMENT_TAG_RANGE_START | |
A start of ranged structured document tag which accepts multi-sections content.
STRUCTURED_DOCUMENT_TAG_RANGE_END = 30 | |
public static final int STRUCTURED_DOCUMENT_TAG_RANGE_END | |
A end of ranged structured document tag which accepts multi-sections content.
GLOSSARY_DOCUMENT = 31 | |
public static final int GLOSSARY_DOCUMENT | |
A glossary document within the main document.
BUILDING_BLOCK = 32 | |
public static final int BUILDING_BLOCK | |
A building block within a glossary document (e.g. glossary document entry).
COMMENT_RANGE_START = 33 | |
public static final int COMMENT_RANGE_START | |
COMMENT_RANGE_END = 34 | |
public static final int COMMENT_RANGE_END | |
OFFICE_MATH = 35 | |
public static final 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.
SUB_DOCUMENT = 36 | |
public static final int SUB_DOCUMENT | |
SYSTEM = 37 | |
public static final int SYSTEM | |
NULL = 38 | |
public static final int NULL | |