Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

how to add HTML document to richtextbox?

$
0
0

Hi,

I want to add a HTML table to richtextbox. I succeeded on adding but with problems. My code adds table but it doesn't take any properties of table for example colspan="2". It simply adds the table.

My sample html table:

<html><head></head><body><table border="1" height="500px" width="500px"><tr><td colspan="3">Header</td></tr><tr><td rowspan="2">Sample</td><td colspan="2">Sample1</td></tr><tr><td>YES</td><td>NO</td></tr><tr><td>R1</td><td>Price1</td><td>Price2</td></tr><tr><td>R2</td><td>Price3</td><td>Price4</td></tr></table></body></html>

Here is my code:

WebBrowser wb = new WebBrowser();   

            try
            {
FileStream fileStream = new FileStream(@"d:\Users\fstylecihat\Desktop\sample.html", FileMode.Open,FileAccess.Read);
            wb.DocumentStream = fileStream;
                Application.DoEvents();
                wb.Document.ExecCommand("SelectAll", false, null);
                wb.Document.ExecCommand("Copy", false, null);
                richTextBox1.Paste();
                richTextBox1.ReadOnly = true;
            }
            finally
            {
                fileStream.Close();
            }

Does RichTextBox control able to show HTML tags with their properties? Any suggestions?

Thanks


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>