//// This code is part of Document Solutions for Word demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingGrapeCity.Documents.Word; namespaceDsWordWeb.Demos{// This sample demonstrates the DsWord Data/Report Templates API,// which allows developers to retrieve all template tags from a document,// along with details such as tag text, associated data element (if any),// and the tag's location within the document.//// In this sample, we retrieve all tags and replace each with a sequence of 'x' characters.// // See also: MarkTagsInPDF for an example of using this API in PDF export scenarios.publicclassXingTemplateTags {publicGcWordDocumentCreateDocx() {var doc = newGcWordDocument(); doc.Load(Path.Combine("Resources", "WordDocs", "House_Rental_Template.docx"));// Fetch information about all data template tags in the document:var tagInfos = doc.DataTemplate.GetTemplateTagInfos();// Replace all tags with sequences of 'X' character:foreach (GrapeCity.Documents.Word.Templates.TemplateTagInfo tagInfo in tagInfos) {var tagText = tagInfo.Text; tagInfo.Range.Replace(tagText, newstring('x', tagText.Length)); }return doc; } }}