Word) (XMLMapping.CustomXMLNode 属性

返回一个 CustomXMLNode 对象,该对象表示文档中的内容控件映射到数据存储区中的自定义 XML 节点。

语法

expressionCustomXMLNode

表达 返回“XMLMapping”对象的表达式。

示例

以下示例在活动文档中插入新的内容控件和自定义 XML 部件,将内容控件映射到自定义 XML 部件中的某个节点,然后设置映射的 XML 节点的值。

Dim objCC As ContentControl 
Dim objPart As CustomXMLPart 
Dim objNode As CustomXMLNode 
Dim objMap As XMLMapping 
 
Set objCC = ActiveDocument.ContentControls.Add(wdContentControlText) 
Set objPart = ActiveDocument.CustomXMLParts.Add("<books><book>" & _ 
 "<author></author><title></title><genre></genre><price></price>" & _ 
 "<pub_date></pub_date><abstract></abstract></book></books>") 
 
Set objMap = objCC.XMLMapping 
objMap.SetMapping "/books/book/author", , objPart 
 
Set objNode = objMap.CustomXMLNode 
objNode.Text = "Matt Hink" 
 
objCC.Range.Text = objNode.Text

另请参阅

XMLMapping 对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。