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.
is_multi_sectionReturns true if this instance is a ranged (multi-section) structured document tag.
is_showing_placeholder_textSpecifies 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.
lock_content_controlWhen set to true, this property will prohibit a user from deleting this SDT.
lock_contentsWhen 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.xml_mapping element or the IStructuredDocumentTag.is_showing_placeholder_text element is true.
placeholder_nameGets or sets Name of the BuildingBlock containing placeholder text.
sdt_typeGets 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.
word_open_xmlGets a string that represents the XML contained within the node in the SaveFormat.FLAT_OPC format.
xml_mappingGets 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
get_child_nodes(node_type, is_deep)Returns a live collection of child nodes that match the specified types.
remove_self_only()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.

doc = aw.Document(file_name=MY_DIR + 'Structured document tags.docx')
# This collection provides a unified interface for accessing ranged and non-ranged structured tags.
sdts = list(doc.range.structured_document_tags)
self.assertEqual(5, len(sdts))
# Here we can get child nodes from the common interface of ranged and non-ranged structured tags.
for sdt in sdts:
    if sdt.get_child_nodes(aw.NodeType.ANY, False).count > 0:
        sdt.remove_self_only()
sdts = list(doc.range.structured_document_tags)
self.assertEqual(0, len(sdts))

See Also