Friday, 20 November 2015

XML : How to display decoded XML text in a richtextfield

  string strY = "<div xmlns="http://www.w3.org/1999/xhtml"><strong>BOLD</strong></div>  <div xmlns="http://www.w3.org/1999/xhtml"> </div>  <div xmlns="http://www.w3.org/1999/xhtml"><u>UNDERLINE</u></div>  <div xmlns="http://www.w3.org/1999/xhtml"> </div>  <div xmlns="http://www.w3.org/1999/xhtml"><em>ITALIC</em></div>";    

I am trying to take the above variable text which is in XML format and display the output in a richtextfield in Windows Form:

  BOLD    UNDERLINE    ITALIC    

Instead of displaying the XML tags.

Form 1:

     FormPreview from = new FormPreview { YourText = strY };     from.UpdateValues();     from.Show();    

Form 2:

     public void UpdateValues()     {            richTextBox1.Text = YourText;     }    

Right now it just displays the strY as the it is without showing the BOLD text in bold, Underling text in underline, Italic text in italic.

How can I code it so it decodes the XML and displays the formatted text in the richtextfield.

If that is not possible, is there a way to open a custom HTML generated page from infopath form?

No comments:

Post a Comment