XMLMapping.XPath 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回一个 字符串 ,表示为 XML 映射,其计算结果为当前映射的 XML 节点的 XPath。 此为只读属性。
public:
property System::String ^ XPath { System::String ^ get(); };
public string XPath { get; }
member this.XPath : string
Public ReadOnly Property XPath As String
属性值
示例
以下示例检查活动文档中第一个内容控件是否是日期控件,以及 XPath 字符串是否设置为特定的内置文档属性。 如果 XPath 不匹配并且控件是日期控件,它将设置到该控件的映射。
<span class="label">Dim objCC As ContentControl
Dim objMap As XMLMapping
Dim blnMap As Boolean
Set objCC = ActiveDocument.ContentControls(1)
Set objMap = objCC.XMLMapping
If (objCC.Type = wdContentControlDate) And (objMap.</span>
<span class="label">XPath</span>
<span class="label"><> _ "/ns1:coreProperties[1]/ns0:createdate[1]") Then blnMap = objMap.SetMapping(XPath:="/ns1:coreProperties[1]/ns0:createdate[1]") If blnMap = False Then MsgBox "Unable to map the content control." End IfEnd If</span>
注解
若要设置内容控件的映射,请使用 SetMapping(String, String, CustomXMLPart) 方法或 SetMappingByNode(CustomXMLNode) 方法。 如果映射不是活动的,则使用此属性将返回错误。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈