Link to home
Start Free TrialLog in
Avatar of sudipta_
sudipta_

asked on

editing an html & simultaneously previewing it

hi!
i'm making an editor in VB with 3 views :
 1)edit-allows user to type plain text
 2)source- shows html source of the text
 3)preview- shows the html preview.

 i want the edit window to show the html output as a user goes on entering text. for eg. when i type the address abc@xyz.com, it must appear as a hyperlink. similarly when i select a stationary(image), it must appear as the textbox's background. i'm using a rtf box

i hope u guys can help me! i could achieve 2) & 3) using the rtf2html parser & the webbrowser control resp. (thanks to EE!)
Avatar of IeuanJ
IeuanJ

Source would just be the text converted to HTML tagged data I presume.  You didn't mention a save option so if you have a routine to convert the text for saving simply use this.  To preview just save the file as a temporary file and open it with a VB web browser.

If you havent made the conversion routine yet then you are asking for a lot of help in what is basically a pretty simple string conversion problem.
Why don't you do away with the rtb and just use a webbrowser in edit mode? That way the user can type directly into the webbrowser and if you want you can display the HTML simultaneously in another window.
What's more, if you do it like this, you can use more elegant methods to create hyperlinks around textranges containing "@" inside the HTML document, as soon as the character is detected.

Kindest regards,
Rhaedes
Avatar of sudipta_

ASKER

thankyou leuanJ,
i have a conversion routine which converts the rtf text to tagged html source so that serves my purpose of 2)
for 3) i 'm using the webbrowser control to render the same html source
what i cant't figure out is how to achieve 1) i.e editing in html mode
again, ty for the input!
thankyou Rhaedes
yes i think you're right, the rtb doesn't help much. basically i'd just kept it so that i can use the formatting methods supported by the rtb.
u say i can use a webbrowser in edit mode, can u pls elaborate on how to do this? i'm using the webbrowser to just output my html (for previewing).
oh, meantime i've discovered that the dhtmledit ocx allows me to edit html in real time, get the html source of a document & render html(output). also in terms of heaviness, it weighs 114k while thw shdocvw.dll required for webbrowser control weighs 1305k. so what do u suggest?
ty for ur time!
ASKER CERTIFIED SOLUTION
Avatar of Rhaedes
Rhaedes

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks a ton Rhaedes!
u perfectly understood my problem & the solution was bang on target.
i took 3 days trying out diff things for this & from what u said bout the dhtmledit being ancient, i guess ur solution is the best bet.
yes the code worked perfectly but in addition to the webbrowser control i also had to reference the html object library (a bit of an overhead but thats ok)
thanks again for ur time, the 'A' is well deserved!
Any time. Thanks for the 'A'. Kindest regards,
Rhaedes