NodeType enumeration

NodeType enumeration

Specifies the type of a Word document node.

Members

NameDescription
AnyIndicates all node types. Allows to select all children.
DocumentA Document object that, as the root of the document tree, provides access to the entire Word document.
SectionA Section object that corresponds to one section in a Word document.
BodyA Body object that contains the main text of a section (main text story).
HeaderFooterA HeaderFooter object that contains text of a particular header or footer inside a section.
TableA Table object that represents a table in a Word document.
RowA row of a table.
CellA cell of a table row.
ParagraphA paragraph of text.
BookmarkStartA beginning of a bookmark marker.
BookmarkEndAn end of a bookmark marker.
EditableRangeStartA beginning of an editable range.
EditableRangeEndAn end of an editable range.
MoveFromRangeStartA beginning of an MoveFrom range.
MoveFromRangeEndAn end of an MoveFrom range.
MoveToRangeStartA beginning of an MoveTo range.
MoveToRangeEndAn end of an MoveTo range.
GroupShapeA group of shapes, images, OLE objects or other group shapes.
ShapeA drawing object, such as an OfficeArt shape, image or an OLE object.
CommentA comment in a Word document.
FootnoteA footnote or endnote in a Word document.
RunA run of text.
FieldStartA special character that designates the start of a Word field.
FieldSeparatorA special character that separates the field code from the field result.
FieldEndA special character that designates the end of a Word field.
FormFieldA form field.
SpecialCharA special character that is not one of the more specific special character types.
SmartTagA smart tag around one or more inline structures (runs, images, fields,etc.) within a paragraph
StructuredDocumentTagAllows to define customer-specific information and its means of presentation.
StructuredDocumentTagRangeStartA start of ranged structured document tag which accepts multi-sections content.
StructuredDocumentTagRangeEndA end of ranged structured document tag which accepts multi-sections content.
GlossaryDocumentA glossary document within the main document.
BuildingBlockA building block within a glossary document (e.g. glossary document entry).
CommentRangeStartA marker node that represents the start of a commented range.
CommentRangeEndA marker node that represents the end of a commented range.
OfficeMathAn 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.
SubDocumentA subdocument node which is a link to another document.
SystemReserved for internal use by Aspose.Words.
NullReserved for internal use by Aspose.Words.

Examples

Shows how to traverse through a composite node’s collection of child nodes.

let doc = new aw.Document();

// Add two runs and one shape as child nodes to the first paragraph of this document.
let paragraph = doc.getParagraph(0, true);
paragraph.appendChild(new aw.Run(doc, "Hello world! "));

let shape = new aw.Drawing.Shape(doc, aw.Drawing.ShapeType.Rectangle);
shape.width = 200;
shape.height = 200;
// Note that the 'CustomNodeId' is not saved to an output file and exists only during the node lifetime.
shape.customNodeId = 100;
shape.wrapType = aw.Drawing.WrapType.Inline;
paragraph.appendChild(shape);

paragraph.appendChild(new aw.Run(doc, "Hello again!"));

// Iterate through the paragraph's collection of immediate children,
// and print any runs or shapes that we find within.
let children = paragraph.getChildNodes(aw.NodeType.Any, false);

expect(paragraph.getChildNodes(aw.NodeType.Any, false).count).toEqual(3);

for (let child of children)
  switch (child.nodeType)
  {
    case aw.NodeType.Run:
      console.log("Run contents:");
      console.log(`\t\"${child.getText().trim()}\"`);
      break;
    case aw.NodeType.Shape:
      let childShape = child.asShape();
      console.log("Shape:");
      console.log(`\t${childShape.shapeType}, ${childShape.width}x${childShape.height}`);
      expect(shape.customNodeId).toEqual(100);
      break;
  }

See Also