Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback. Word Object Model Reference Support and feedback For more information about working with CustomXMLNode and CustomXMLPart objects, see the respective object topics. Use the CustomXMLPart property to access the XML part to which a content control maps. Use the CustomXMLNode property to access the XML node to which a content control maps. The following example deletes the XML mapping for all mapped content controls in the active document. Use the IsMapped property to determine if a content control is mapped to an XML node in the document's data store. Dim objCC As ContentControlįor Each objCC In ActiveDocument.ContentControls The following example deletes the XML mapping for all content controls in the active document that are currently mapped. Both the content control and the XML data remain in the document. Deleting the XML mapping for a content control deletes only the connection between the content control and the XML data. Use the Delete method to remove the XML mapping for a content control. Set objRange = ActiveDocument.Paragraphs(2).Range Set objCustomControl = ActiveDocument.ContentControls _ Set objCustomNode = objCustomPart.SelectSingleNode _ Set objRange = ActiveDocument.Paragraphs(1).Range "in the fall, and then back to your back yard in the spring." & _Ī The following example sets the built-in document property for the document author, inserts a new content control into the active document, and then sets the XML mapping for the control to the built-in document property. "of the red breasted robin as it migrates to warmer climes " & _ Use the SetMapping method to add or change the XML mapping for a content control using an XPath string. "Migration Paths of the Red Breasted Robin" & _ The following example creates a new CustomXMLPart object, loads custom XML into it, and then creates two new content controls and maps each to a different XML element within the custom XML. Set objNode = _īlnMap = objMap.SetMappingByNode(objNode) The following example does the same thing as the previous example, but uses the SetMappingByNode method. Use the SetMappingByNode method to add or change the XML mapping for a content control using a CustomXMLNode object. MsgBox "Unable to map the content control." (wdContentControlDate, ActiveDocument.Paragraphs(1).Range)īlnMap = objMap.SetMapping(XPath:="/ns1:coreProperties/ns0:createdate") Dim objcc As ContentControlĪctiveDocument.BuiltInDocumentProperties("Author").Value = "David Jaffe" Use the SetMapping method to add or change the XML mapping for a content control using an XPath string. An XML mapping is a link between the text in a content control and an XML element in the custom XML data store for this document. Represents the XML mapping on a ContentControl object between custom XML and a content control.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |