Infopath textbox displaying html tags

2019-08-22 03:48发布

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条回答
虎瘦雄心在
2楼-- · 2019-08-22 03:52

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

查看更多
登录 后发表回答