Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a HTML string

Status
Not open for further replies.

Mungovan

Programmer
Oct 24, 2002
94
IE
Hi.
I have a string called sFrag that contain HTML code of the form
sFrag = &quot; <TABLE> <TR> <B> Hello World ........ <\TABLE> &quot;

I need this to be printed to the printer in its table format. But when I try Printer.Print sFrag it just prints the characters and text (and not in the table format I want)

Any ideas of how to print it so it's in its nice formatted Table HTML format.


Anyway, thanks for the help,

D
 
Hi.
I have the webbrowser printing the HTML file properly now, but only when I place a message box in between the following lines:

WebBrowser1.Navigate &quot;Print.html&quot;
MsgBox &quot;Printing ...&quot;
WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER

When I remove the message box an error is reported.

Sound.

Thanks,
D
 
You haven't given the page time to load. Print from the WebBrowser control's DownloadComplete() event instead. This event is fired when the page is fully downloaded

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 

Thanks strongm, it's just that we couldn't get your solution to work, we did try!!!

Johnwm,
There is no DownloadComplete() event on the webbrowser control????

D
 
Which WebBrowser control are you using? The standard VB WebBrowser (from shdocvw.dll) has a DownloadComplete event (I've just used it to make sure)

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
We just decided to put a delay into the application which allowed the system to update the WebBrowser.


Another Question:
It's all working grand now except:
When the screen to prompt for a printer is displayed and the user clicks cancel, there is an application error.
How can this be solved or what's goin on?

Thanks for the Help,
D
 
what is the error?

Known is handfull, Unknown is worldfull
 
Mungovan, since we're still not sure which webbrowser control you are using (e.g. all the rest of us are using one with a DownloadComplete event and you, apparantly, are not) it is rather difficult to diagnose your problem further. Could you try and answer johnwm's earlier question: which webbrowser control are you using?
 
Thanks,
How do I find out which WebBrowser control I am using?
Is it in the properties section?

D
 
The correct webbrowser control (the one we are all talking about) comes from the Microsoft Internet controls (Project|Components|Microsoft Internet Controls) which is in shdocvw.dll.

Make sure that you have VB6 SP5 applied. It's available from:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Yes, that is the webbrowser control that I am using.
 
In your form module select your webbrowser control name from the Object (left hand) dropdown box. You should then find DownloadComplete event in your Procedure (right hand) dropdown

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top