How to display the HTML content from XML in winforms [modified]
-
Hi, I have maintained html formatted text(help information) in XML file. like the following eg.
**Login: ** Press login button to login into the page
**View: ** Press View button to view the configuration details.
...So iam taking the contents of Node Page1 using XML document to display the help for Page1 in Richtext box. But Richtext box not recognizing HTML tags. It simply display the contents.. How to present this content. Is it possible with RTB or is there any controls to display this HTML formatted text. Thanks Srini -- modified at 14:46 Friday 2nd March, 2007
-
Hi, I have maintained html formatted text(help information) in XML file. like the following eg.
**Login: ** Press login button to login into the page
**View: ** Press View button to view the configuration details.
...So iam taking the contents of Node Page1 using XML document to display the help for Page1 in Richtext box. But Richtext box not recognizing HTML tags. It simply display the contents.. How to present this content. Is it possible with RTB or is there any controls to display this HTML formatted text. Thanks Srini -- modified at 14:46 Friday 2nd March, 2007
You can use the WebBrowser control to display html formatted text.
-
You can use the WebBrowser control to display html formatted text.
I can't use webbrowser..... since i am will only the text from XML. for displaying it in Webbrowser...we need to put into a separate HTML file.. and have to direct the webbrowser to that file path.... that is tedious job... and the webbrowser is not a stable component.. Any other solution here.
-
I can't use webbrowser..... since i am will only the text from XML. for displaying it in Webbrowser...we need to put into a separate HTML file.. and have to direct the webbrowser to that file path.... that is tedious job... and the webbrowser is not a stable component.. Any other solution here.
The RichTextBox control does not support HTML formatting. In order to display the formatted text, you need to convert the HTML to RTF, then set the RichTextBox.Rtf property to the converted text. The slick way to do it would be to create your own ICustomFormatter object that converts HTML markup to RTF, then pass it, along with your HTML string to StringBuilder.AppendFormat. I don't know of any other way to tackle this problem. I'm sure there is a myriad of conversion tools out there and quite possibly an article or two on that topic on CP. Sorry I don't have a better solution. Perhaps someone else does? Ian
-
I can't use webbrowser..... since i am will only the text from XML. for displaying it in Webbrowser...we need to put into a separate HTML file.. and have to direct the webbrowser to that file path.... that is tedious job... and the webbrowser is not a stable component.. Any other solution here.