显示html标签的Infopath文本框 [英] Infopath textbox displaying html tags

查看:171
本文介绍了显示html标签的Infopath文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何阻止Infopath在我的文本框中显示html标签?例如,我的文本框有:

How do I stop Infopath from displaying html tags in my text box? For example, my textbox has:

你好

世界!

,但它会在打印预览中显示为:
hello
the world!

but it will show up in the print preview as: "hello

world!"

奇怪的是,Infopath正在将我的文本转换为包含html ..

Strangely, Infopath is converting my text to include html..

推荐答案

不能使用文本框将HTML文本显示为呈现的HTML - 您需要使用丰富的文本框。

You cannot use a textbox to display HTML text as rendered HTML - you will need to use a rich text box.

然后,您必须以编程方式将HTML作为子节点添加到文本框中,如下所示:

You then would have to programatically add your HTML as child nodes to the text box like so:

MainDataSource.CreateNavigator().SelectSingleNode("//my:rtfField", NamespaceManager).AppendChild("<h2 xmlns=\"http://www.w3.org/1999/xhtml\">Header Text</h2><p xmlns=\"http://www.w3.org/1999/xhtml\">This is some paragraph text.</p>");

如何实现您想要的内容的一个很好的解释是:如何让HTML标记显示为HTML而不是纯文本一个富文本框

A good explanation of how to achieve what you want is here: How to get HTML tags to appear as HTML and not as plain text in a Rich Text Box

以及一些与HTML +文本框相关的其他链接: InfoPath中的Rich Text Box

And some further links related to HTML + Textboxes: Rich Text Boxes in InfoPath

这篇关于显示html标签的Infopath文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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