StructuredDocumentTagCollection class

StructuredDocumentTagCollection class

A collection of IStructuredDocumentTag instances that represent the structured document tags in the specified range. To learn more, visit the Structured Document Tags or Content Control documentation article.

Indexers

NameDescription
__getitem__(index)Returns the structured document tag at the specified index.

Properties

NameDescription
countReturns the number of structured document tags in the collection.

Methods

NameDescription
get_by_id(id)Returns the structured document tag by identifier.
get_by_tag(tag)Returns the first structured document tag encountered in the collection with the specified tag.
get_by_title(title)Returns the first structured document tag encountered in the collection with the specified title.
remove(id)Removes the structured document tag with the specified identifier.
remove_at(index)Removes a structured document tag at the specified index.

Examples

Shows how to get structured document tag.

doc = aw.Document(file_name=MY_DIR + 'Structured document tags by id.docx')
# Get the structured document tag by Id.
sdt = doc.range.structured_document_tags.get_by_id(1160505028)
print(sdt.is_multi_section)
print(sdt.title)
# Get the structured document tag or ranged tag by Title.
sdt = doc.range.structured_document_tags.get_by_title('Alias4')
print(sdt.id)

See Also