IStructuredDocumentTag class

IStructuredDocumentTag class

Interface to define a common data for StructuredDocumentTag and StructuredDocumentTagRangeStart.

Properties

NameDescription
appearanceGets or sets the appearance of the structured document tag.
colorGets or sets the color of the structured document tag.
idSpecifies a unique read-only persistent numerical Id for this SDT.
isMultiSectionReturns true if this instance is a ranged (multi-section) structured document tag.
isShowingPlaceholderTextSpecifies whether the content of this SDT shall be interpreted to contain placeholder text (as opposed to regular text contents within the SDT).
levelGets the level at which this SDT occurs in the document tree.
lockContentControlWhen set to true, this property will prohibit a user from deleting this SDT.
lockContentsWhen set to true, this property will prohibit a user from editing the contents of this SDT.
nodeReturns Node object that implements this interface.
placeholderGets the BuildingBlock containing placeholder text which should be displayed when this SDT run contents are empty, the associated mapped XML element is empty as specified via the IStructuredDocumentTag.xmlMapping element or the IStructuredDocumentTag.isShowingPlaceholderText element is true.
placeholderNameGets or sets Name of the BuildingBlock containing placeholder text.
sdtTypeGets type of this Structured document tag.
tagSpecifies a tag associated with the current SDT node. Can not be null.
titleSpecifies the friendly name associated with this SDT. Can not be null.
wordOpenXMLGets a string that represents the XML contained within the node in the SaveFormat.FlatOpc format.
xmlMappingGets an object that represents the mapping of this structured document tag to XML data in a custom XML part of the current document.

Methods

NameDescription
getChildNodes(nodeType, isDeep)Returns a live collection of child nodes that match the specified types.
removeSelfOnly()Removes just this SDT node itself, but keeps the content of it inside the document tree.

Examples

Shows how to remove structured document tag, but keeps content inside.

let doc = new aw.Document(base.myDir + "Structured document tags.docx");

// This collection provides a unified interface for accessing ranged and non-ranged structured tags. 
let sdts = doc.range.structuredDocumentTags;
expect(sdts.count).toEqual(5);

// Here we can get child nodes from the common interface of ranged and non-ranged structured tags.
for (let sdt of sdts)
{
  if (sdt.getChildNodes(aw.NodeType.Any, false).count > 0)
    sdt.removeSelfOnly();
}

sdts = doc.range.structuredDocumentTags;
expect(sdts.count).toEqual(0);

See Also