|
-
Jul 7th, 2010, 07:47 AM
#1
Thread Starter
Lively Member
Load HTML file into RTB
Hi All,
Is it possible to load a .html file (containing a simple table) in a richtextbox ?
if yes how ?
the reason why i wanna do that is i want to highlight certain text after the content has been loaded in the RTB.
-
Jul 7th, 2010, 08:14 AM
#2
Re: Load HTML file into RTB
do you want it as raw HTML? If so, then simply set the text property to the HTML. If you want the HTML to be converted into the RTF equivalent and have the markup show in the RTB... it would need to be run through an HTML2RTF converter of some kind.
-tg
-
Jul 7th, 2010, 08:19 AM
#3
Addicted Member
Re: Load HTML file into RTB
What about using a WebBrowser control instead, first parsing the html and highlighting what you want, then use the browsers DocumentText property to display the page?
-
Jul 8th, 2010, 04:08 AM
#4
Thread Starter
Lively Member
Re: Load HTML file into RTB
ok guys i found a work around, but der's still few probs...
this is wht my tool does :
- Take a shared folder path as input on a textbox
- Pass that path to a powershell script & run that script using "shell" --> cmd.exe /c powershell -nologo -noninteractive "C:\MyFolder\first.ps1"
- My powershell script will dump a HTML file as its output
- I'll load that HTML in a webrowser control on my form.
Here are the problems i'm facing...
1- During run time i need to create the powershell script (C:\MyFolder\first.ps1) which has HTML code for creating a table which looks like this :
Code:
$a = "<style>"
$a = $a + "BODY{background-color:skyblue;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:palegoldenrod}"
$a = $a + "</style>"
for writing this to a .ps1 file (using StreamWriter) i need to add lots of "quotes" since it recognises --> $, <> , {} as operational characters is there any i can simply dump the above code into a file without having to format it, it's really tiresome 
2- Original problem : is der any way i can highlight certain text on webBrowser control ?
I'm not advanced coder so i'll be grateful if you provide me a code along with reply.. thx already !
-
Jul 8th, 2010, 07:50 AM
#5
Thread Starter
Lively Member
Re: Load HTML file into RTB
-
Jul 12th, 2010, 12:09 PM
#6
Thread Starter
Lively Member
Re: Load HTML file into RTB
guys, sorry for double-posting but i'm still stuck on this, i simply need to know how can i easily write below code to a file (using streamwriter or equivalent)
Code:
$a = "<style>"
$a = $a + "BODY{background-color:skyblue;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:palegoldenrod}"
$a = $a + "</style>"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|