WebBrowser ?
-
Hi. Is it possible to change content of a WebBrowser object in C# without using HTML files ? I mean : For example we have following XHTML code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<style type="text/css">
<!--
body,td,th {
color: #000;
}
body {
background-color: #990;
}
-->
</style></head><body>
<table width="100%" border="1">
<tr>
<td align="center">TEST01</td>
<td align="center">test02</td>
</tr>
<tr>
<td><p>test03</p></td>
<td align="center">test04</td>
</tr>
</table>
</body>
</html>Now , I wanna show the design in WebBrowser => http://img143.imageshack.us/img143/6855/50068901.png[^] I would be appreciate if you guide me !
-
Hi. Is it possible to change content of a WebBrowser object in C# without using HTML files ? I mean : For example we have following XHTML code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<style type="text/css">
<!--
body,td,th {
color: #000;
}
body {
background-color: #990;
}
-->
</style></head><body>
<table width="100%" border="1">
<tr>
<td align="center">TEST01</td>
<td align="center">test02</td>
</tr>
<tr>
<td><p>test03</p></td>
<td align="center">test04</td>
</tr>
</table>
</body>
</html>Now , I wanna show the design in WebBrowser => http://img143.imageshack.us/img143/6855/50068901.png[^] I would be appreciate if you guide me !
I do believe you can set the HTML of the control. If you can't, you can always save this HTML locally and point the control to it.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I do believe you can set the HTML of the control. If you can't, you can always save this HTML locally and point the control to it.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
I do believe you can set the HTML of the control.
Could you please guide me , which method or property do it in WebBrowser ?
-
Christian Graus wrote:
I do believe you can set the HTML of the control.
Could you please guide me , which method or property do it in WebBrowser ?
Try DocumentText[^] (Try having a look at the documentation some time - it realy is quicker than asking here...)
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones
-
Try DocumentText[^] (Try having a look at the documentation some time - it realy is quicker than asking here...)
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones
Thanks a lot my friend.
-
Hi. Is it possible to change content of a WebBrowser object in C# without using HTML files ? I mean : For example we have following XHTML code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<style type="text/css">
<!--
body,td,th {
color: #000;
}
body {
background-color: #990;
}
-->
</style></head><body>
<table width="100%" border="1">
<tr>
<td align="center">TEST01</td>
<td align="center">test02</td>
</tr>
<tr>
<td><p>test03</p></td>
<td align="center">test04</td>
</tr>
</table>
</body>
</html>Now , I wanna show the design in WebBrowser => http://img143.imageshack.us/img143/6855/50068901.png[^] I would be appreciate if you guide me !
it's possible to change content of a webbrowser object in c# by using a string; for example : private void WriteHtml(string s){ //stream to string MemoryStream ms = new MemoryStream(); try{ byte[] htmlcode = System.Text.Encoding.Default.GetBytes(s); ms.Write(htmlcode,0,htmlcode.Length); Stream dataStream = ms; //Position dataStream.Seek(0,0); if(axWb.Document!=null){ //to IStream (axWb.Document as UnsafeNativeMethods.IPersistStreamInit).Load(new UnsafeNativeMethods.ComStreamFromDataStream(dataStream)); } }finally{ ms.Close(); } }