Infopath textbox displaying html tags

拥有回忆 提交于 2019-12-11 21:31:40

问题


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

"Hello

World!"

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

world!"

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


回答1:


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

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>");

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

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



来源:https://stackoverflow.com/questions/5534621/infopath-textbox-displaying-html-tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!