Results 1 to 6 of 6

Thread: Load HTML file into RTB

  1. #1

    Thread Starter
    Lively Member sk8er_boi's Avatar
    Join Date
    Jun 2010
    Posts
    65

    Question 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.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Addicted Member DramaQueen's Avatar
    Join Date
    Mar 2010
    Posts
    187

    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?

  4. #4

    Thread Starter
    Lively Member sk8er_boi's Avatar
    Join Date
    Jun 2010
    Posts
    65

    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 :
    1. Take a shared folder path as input on a textbox
    2. Pass that path to a powershell script & run that script using "shell" --> cmd.exe /c powershell -nologo -noninteractive "C:\MyFolder\first.ps1"
    3. My powershell script will dump a HTML file as its output
    4. 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 !

  5. #5

    Thread Starter
    Lively Member sk8er_boi's Avatar
    Join Date
    Jun 2010
    Posts
    65

    Re: Load HTML file into RTB

    any 1 pls....

  6. #6

    Thread Starter
    Lively Member sk8er_boi's Avatar
    Join Date
    Jun 2010
    Posts
    65

    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
  •  



Click Here to Expand Forum to Full Width