Chaya
asked on
Display html in rich text box
What I want is the following:
I have the path of a html file (with text only, no tables pictures etc.). I want to display the text in the rich text box.
The text must be displayed with all the font settings i.e. font color, size, bold etc.
The user can then edit the text (I already have code to save the rich text box as html).
Some ideas how to solve:
1. Alogrithm to analyse the html tags.
2. Load the page into a webbrowser object and the use the document.body.innertext to get the text (doesn't give the text format).
I'll appreciate a clear answer with a working example.
I have the path of a html file (with text only, no tables pictures etc.). I want to display the text in the rich text box.
The text must be displayed with all the font settings i.e. font color, size, bold etc.
The user can then edit the text (I already have code to save the rich text box as html).
Some ideas how to solve:
1. Alogrithm to analyse the html tags.
2. Load the page into a webbrowser object and the use the document.body.innertext to get the text (doesn't give the text format).
I'll appreciate a clear answer with a working example.
ASKER
Your answer might help me...
Is it possible to allow the user to edit the webbrowser text format i.e. change selected font to bold etc.
I need that the editing of the text will be as flexible as by the rich text box object.
Thanks for the speedy reply
Is it possible to allow the user to edit the webbrowser text format i.e. change selected font to bold etc.
I need that the editing of the text will be as flexible as by the rich text box object.
Thanks for the speedy reply
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I tried your code and it works well.
But...
I still have one problem with it:
I want the user to be able to use it like a text editor without realizing it is a webbrowser. I want to know how to cancel the internet popup that comes up with a right click and to display instead my own popup (that has options for changing fonts, bold etc.)
Could you provide me with code for this? I will provide 20 bonus points
But...
I still have one problem with it:
I want the user to be able to use it like a text editor without realizing it is a webbrowser. I want to know how to cancel the internet popup that comes up with a right click and to display instead my own popup (that has options for changing fonts, bold etc.)
Could you provide me with code for this? I will provide 20 bonus points
ASKER
I have found code to do the above (change menu with right click). I'm checking the code now.
ASKER
I have found code to do the above (change menu with right click). I'm checking the code now.
Since Hdoc is declared as withevents, you can trap mouse clicks on the document, and even have different popups depending on the element under the mouse. Basically, use the sub 'Private Sub HDoc_onmousedown()' and chack for a right mouse click using 'If HDoc.parentWindow.event.bu tton = 2 Then...'
You could check out Richie Simon's code at http://www.angelfire.com/realm/vb-shared/IE_WB_DOM_tips.htm#overrwb
Kindest regards,
Rhaedes
You could check out Richie Simon's code at http://www.angelfire.com/realm/vb-shared/IE_WB_DOM_tips.htm#overrwb
Kindest regards,
Rhaedes
ASKER
You seem to be the expert in webbrowsers. Any chance of help with the following:
1.How can I prevent the user from draging and dropping images from other webbrowser controls
2. How can I cause that some webbrowser controls on the form will have no popup menus and others will have my pop up menu
1.How can I prevent the user from draging and dropping images from other webbrowser controls
2. How can I cause that some webbrowser controls on the form will have no popup menus and others will have my pop up menu
For example, put a webbrowser on a form and add this code:
Private Sub Form_Load()
WebBrowser1.Navigate ("about:blank")
End Sub
Private Sub WebBrowser1_DocumentComple
WebBrowser1.Document.desig
End Sub
Obviously, the navigate method loads the file into the webbrowser. To save the file once you've edited it, write the string 'WebBrowser1.Document.All(
Kindest regards,
Rhaedes