"Mohan" <mo*******@yahoo.com> wrote in message
news:95**************************@posting.google.c om...
Hi All,
I am using web browser control in a VB 6.0 client server application
to print reports.
I am writing the report into a HTML file and displays the report to
the user using the code, webbrowsercontrol.navigate2 "path of the html
file" method.
When the user clicks command button on the VB form to print the report
I am using the following code, webbrowsercontrol.ExecWB
OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER to print the report
In addition to the report displayed printer prints the following which
the user dont want to be printed
a.Page x of y (at the top right corner)
b.path where the file is stored (at the bottom left corner)
c.date (at the bottom right corner)
Is anyboody knows how to prevent the above things from getting
printed?
Thanks
Mohan
The headers and footers are determined by user settings in the page setup
dialog. You could have a page setup option in your application, displaying
the page setup dialog (OLECMDID_PAGESETUP) and leave it up to the user. The
drawback is that this will also affect the settings in Internet Explorer and
any other applications based on the webbrowser control.
You could also use print templates to customize the headers and footers, but
there seems to be a security issue because print templates are trusted code,
and so depending on the IE version, this may or may not work. See the
following article:
PRB: Cannot Use ExecWB() to Print HTML Documents with Print Templates in
Visual Basic
http://support.microsoft.com/default...b;en-us;308649
It seems there may be a way to pass custom headers and footers in the pvaIn
parameter, but the only examples I can find are in C++, using a SafeArray
(whatever that means). But if you know C++, maybe you can port the code to
VB. See the following article:
HOWTO: Print Custom Headers and Footers for a WebBrowser Control
http://support.microsoft.com/default...b;en-us;267240
HTH
--
Björn Holmgren
Guide Konsult AB