ignore_structured_document_tags property
FindReplaceOptions.ignore_structured_document_tags property
Gets or sets a boolean value indicating either to ignore content of StructuredDocumentTag.
The default value is False
.
@property
def ignore_structured_document_tags(self) -> bool:
...
@ignore_structured_document_tags.setter
def ignore_structured_document_tags(self, value: bool):
...
Remarks
When this option is set to True
, the content of StructuredDocumentTag
will be treated as a simple text.
Otherwise, StructuredDocumentTag will be processed as standalone Story and replacing pattern will be searched separately for each StructuredDocumentTag, so that if pattern crosses a StructuredDocumentTag, then replacement will not be performed for such pattern.
Examples
Shows how to ignore content of tags from replacement.
doc = aw.Document(MY_DIR + "Structured document tags.docx")
# This paragraph contains SDT.
p = doc.first_section.body.get_child(aw.NodeType.PARAGRAPH, 2, True).as_paragraph()
import aspose.words.saving as aws
text_to_search = p.to_string(aw.SaveFormat.TEXT).strip()
options = aw.replacing.FindReplaceOptions()
options.ignore_structured_document_tags = True
doc.range.replace(text_to_search, "replacement", options)
doc.save(ARTIFACTS_DIR + "StructuredDocumentTag.IgnoreStructuredDocumentTags.docx");
See Also
- module aspose.words.replacing
- class FindReplaceOptions