更改与内容控件链接的customxml [英] change customxml linked with a content control
本文介绍了更改与内容控件链接的customxml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果您在运行时更改了与内容控件链接的customxml,则需要关闭并打开de document以查看内容控件中的更改?????
Hi, if you change a customxml, linked with a content control, in runtime, it's necesary close and open de document to see changes in your content control ?????
注意:我已使用互操作词更改了customxml
Note: I have changed customxml with interop word
推荐答案
您好RamonMR,
Hi RamonMR,
感谢您发帖。
我通过vba测试了我的身边,然而,文档不需要关闭并重新打开。我使用以下代码片段:
I tested on my side via vba, however, the document does not need to be closed and reopened on my side. I use the following code snippet:
Sub AddCustomXMlPart()
If ActiveDocument.CustomXMLParts.Count = 4 Then
ActiveDocument.CustomXMLParts(4).Delete
ActiveDocument.CustomXMLParts.Add
ActiveDocument.CustomXMLParts(4).Load ("C:\Users\v-bpeng\Desktop\MapContentControl\CustomLetter.xml")
Else
ActiveDocument.CustomXMLParts.Add
ActiveDocument.CustomXMLParts(4).Load ("C:\Users\v-bpeng\Desktop\MapContentControl\CustomLetter.xml")
End If
End Sub
Sub MapXml()
Dim strXPath1 As String
strXPath1 = "/Customer/CompanyName"
ActiveDocument.ContentControls(1).XMLMapping.SetMapping strXPath1
Dim strXPath2 As String
strXPath2 = "/Customer/ContactName"
ActiveDocument.ContentControls(2).XMLMapping.SetMapping strXPath2
Dim strXPath3 As String
strXPath3 = "/Customer/ContactTitle"
ActiveDocument.ContentControls(3).XMLMapping.SetMapping strXPath3
Dim strXPath4 As String
strXPath4 = "/Customer/Phone"
ActiveDocument.ContentControls(4).XMLMapping.SetMapping strXPath4
End Sub
所以,我认为你可能没有删除原来的xml插入新文件之前的文件。
So, I think it possible that you didn't delete the original xml file before inserting the new one.
最好的问候,
这篇关于更改与内容控件链接的customxml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文