IgnoreStructuredDocumentTags

FindReplaceOptions.IgnoreStructuredDocumentTags property

Gets or sets a boolean value indicating either to ignore content of StructuredDocumentTag. The default value is false.

public bool IgnoreStructuredDocumentTags { get; set; }

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.

Document doc = new Document(MyDir + "Structured document tags.docx");

// This paragraph contains SDT.
Paragraph p = (Paragraph)doc.FirstSection.Body.GetChild(NodeType.Paragraph, 2, true);
string textToSearch = p.ToString(SaveFormat.Text).Trim();

FindReplaceOptions options = new FindReplaceOptions() { IgnoreStructuredDocumentTags = true };
doc.Range.Replace(textToSearch, "replacement", options);

doc.Save(ArtifactsDir + "StructuredDocumentTag.IgnoreStructuredDocumentTags.docx");

See Also