FieldIncludeTextNamespaceMappings Property |
Namespace: Aspose.Words.Fields
public void FieldIncludeText() { Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Use a document builder to insert an include text field and perform an XSL transformation on an XML document FieldIncludeText fieldIncludeText = CreateFieldIncludeText(builder, MyDir + "CD collection data.xml", false, "text/xml", "XML", "ISO-8859-1"); fieldIncludeText.XslTransformation = MyDir + "CD collection XSL transformation.xsl"; builder.Writeln(); // Use a document builder to insert an include text field and use an XPath to take specific elements fieldIncludeText = CreateFieldIncludeText(builder, MyDir + "CD collection data.xml", false, "text/xml", "XML", "ISO-8859-1"); fieldIncludeText.NamespaceMappings = "xmlns:n='myNamespace'"; fieldIncludeText.XPath = "/catalog/cd/title"; doc.Save(ArtifactsDir + "Field.INCLUDETEXT.docx"); } /// <summary> /// Use a document builder to insert an INCLUDETEXT field and set its properties. /// </summary> public FieldIncludeText CreateFieldIncludeText(DocumentBuilder builder, string sourceFullName, bool lockFields, string mimeType, string textConverter, string encoding) { FieldIncludeText fieldIncludeText = (FieldIncludeText)builder.InsertField(FieldType.FieldIncludeText, true); fieldIncludeText.SourceFullName = sourceFullName; fieldIncludeText.LockFields = lockFields; fieldIncludeText.MimeType = mimeType; fieldIncludeText.TextConverter = textConverter; fieldIncludeText.Encoding = encoding; return fieldIncludeText; }