IgnoreStructuredDocumentTags

FindReplaceOptions.IgnoreStructuredDocumentTags property

Ruft einen booleschen Wert ab oder setzt ihn, der angibt, ob der Inhalt vonStructuredDocumentTag . Der Standardwert istFALSCH .

public bool IgnoreStructuredDocumentTags { get; set; }

Bemerkungen

Wenn diese Option aufWAHR , der Inhalt vonStructuredDocumentTag wird als einfacher Text behandelt.

AndernfallsStructuredDocumentTag wird als eigenständige Story verarbeitet und das ersetzende Muster wird für jedeStructuredDocumentTag , , so dass, wenn das Muster einStructuredDocumentTag , dann wird für dieses Muster kein Ersatz durchgeführt.

Beispiele

Zeigt, wie der Inhalt von Tags beim Ersetzen ignoriert wird.

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

// Dieser Absatz enthält 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");

Siehe auch