如何摆脱“点击此处输入文字”用于使用从序列化器生成的 xml 进行文字内容控制

发布于 2024-09-16 01:18:18 字数 579 浏览 5 评论 0原文

当您将内容控件映射到没有结束标记的 xml 时,就会出现此问题。例如。如果 xml 是并且已映射到文字控件,则与映射 Word 文档上显示的文本(启用编辑或打印)类似,

即使您在创建内容控件时已删除文本,也可以单击此处输入文本。但如果我将 xml 更改为 ,它就可以正常工作,并且我看不到任何默认文本。

所以问题是我在使用 xml 序列化程序序列化的对象中有大约 50-60 个字段,而不是默认情况下它序列化为 .因此,对于整个文档,所有空 xml 标签都在 Word 文档中显示默认文本。

这是一个已知问题还是我遗漏了一些东西?有没有办法调整生成的 xml 以显式具有结束标记?

这很容易重新创建。我正在使用 xml sdk v 2.0 和 word 2010。

问候

Mac

编辑注意: 我仍然面临这个问题。当自定义 xml 具有时,它会显示文本“单击此处输入文本”。如果我有 xml 就可以正常工作。问题是我覆盖了 xml,它将强制生成结束标签。但是当我在 xml 文档中解析时,它再次将其转换为自关闭标签。

有没有办法查看空内容控件并使用 sdk 2.0 将其从文档中删除?

This issue occurs when you have your content control mapped to xml that doesnt have closing tag. For eg. if the xml is and is mapped to literal control than on mapping the text displayed on word document(enable editing or printing) with be something like this

Click here to enter text even if you have removed the text when you create the content control. But if i change xml to than it works fine and i dont see any default text.

So the problem is that i have around 50-60 fields in the object that is serialized using xml serializer than by default it serializes to . So for entire document all the empty xml tags have default text displayed in word document.

Is this a known issue or am i missing something on my end? Is there a way is tweak generated xml to explicitly have closing tag?

This is very easy to recreate. I am using xml sdk v 2.0 and word 2010.

Regards

Mac

Edit Note:
I am still facing this issue. When the custom xml has than it displays the text "Click here to enter text." If i have xml than it works fine. The problem is i have override xml that will force to generate the end tags. But when i parse within xml document it again converts it to self closing tags.

Is there a way to look through the empty content controls and remove it from the document using sdk 2.0?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文