标签不包含在元素上 [英] Tag not included on Element

查看:68
本文介绍了标签不包含在元素上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在执行以下代码来更新现有xml文件中的文本元素。此文件来自保存为.xml的word文档。

在保存文件时,目标文本元素正在保存,但不包含周围的"w:t"标记。而是只有文本进入更新的文件,这导致Word错误地显示文本字段。

任何人,如何在不丢失标签的情况下更新此文本字段?


进口

Hello,

I'm executing the following code to update a text element in an existing xml file. This file is from a word document saved as .xml.

On saving of the file the target text element is being saved, but the surrounding 'w:t' tag is not being included. Instead only the text goes into the updated file, which causes Word to mishandle displaying the text field.

Anyone, How can I get this text field updated without loosing the tag?

Imports

< xmlns:w = ' http://schemas.microsoft.com/office/word/2003/wordml ' >

对于 < span style ="font-size:x-small; color:#0000ff">每个 目标 查询
Dim root As XElement = < w:t > TESTI < / w:t >
target.Value = root
下一个

谢谢。

For Each target In query
Dim root As XElement = <w:t>TESTI</w:t>
target.Value = root
Next

Thanks.

推荐答案

它不是明确你想要达到的目标。如果target是一个XElement并且您希望将根XElement放在目标内部然后使用ReplaceAll例如
target.ReplaceAll(root)

如果这没有帮助那么请详细解释一下你是什么想要实现,向我们展示目标元素在变化之前的样子以及你希望它在变化之后的样子。
It is not clear what you want to achieve. If target is an XElement and you want place the root XElement inside of target then use ReplaceAll e.g.
target.ReplaceAll(root)

If that does not help then please explain in more detail what you want to achieve, showing us how a target element looks before the change and how you want it to look after the change.


这篇关于标签不包含在元素上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆