Re: WebBrowser Control Printing
- From: v-terryf@xxxxxxxxxxxxxxxxxxxx ("TerryFei")
- Date: Tue, 14 Mar 2006 08:23:06 GMT
Hi Alex,
Thanks for your response!
aAfter further investigation on the web I'm still fairly convinced this is
asC++ only option, due to the wrapping of COM Variant types - .NET interop
will, apparently, not support this at all, unless something has changed
WebBrowser control provide us IWebBrowser2 com-interface and we can use.of 2.0.
this interface to control WebBrowser control's operation. IWebBrowser2 is
an IDispatch interface, in a word, this is a dual-interface, so we can use
it in C++ and VB. If your environment is .Net, we could use it with
Interoperability mechanism. I hope the following articles will be helpful
for you:
Title: Using the WebBrowser control in .NET
URL: http://www.codeproject.com/csharp/webbrowser.asp
Title: Using MSHTML Advanced Hosting Interfaces
URL: http://www.codeproject.com/csharp/advhost.asp
Title: Microsoft Web Browser Automation using C#
URL: http://www.codeproject.com/csharp/mshtml_automation.asp
I hope the above information is helpful for you. If there is anything I
can do for you, please feel free to let me know. Thanks and have a nice day!
Best Regards,
Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
Reply-To: "Alex Clark" <honeycomb@xxxxxxxxxxxxxxxxx><e68kZa4QGHA.2536@xxxxxxxxxxxxxxxxxxxx>
From: "Alex Clark" <honeycomb@xxxxxxxxxxxxxxxxx>
References: <#5I1TE4QGHA.2156@xxxxxxxxxxxxxxxxxxxx>
<#8dKtk4QGHA.2436@xxxxxxxxxxxxxxxxxxxx>
<OkLFEw4QGHA.5500@xxxxxxxxxxxxxxxxxxxx>
Subject: Re: WebBrowser Control Printing86.134.248.72
Date: Thu, 9 Mar 2006 16:22:23 -0000
Lines: 116
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Response
Message-ID: <e7P0gW5QGHA.5036@xxxxxxxxxxxxxxxxxxxx>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: host86-134-248-72.range86-134.btcentralplus.com
Path: TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbla
Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.vb:321151
X-Tomcat-NG: microsoft.public.dotnet.languages.vb
Hi Colin,
After further investigation on the web I'm still fairly convinced this is
C++ only option, due to the wrapping of COM Variant types - .NET interopshame,
will, apparently, not support this at all, unless something has changed as
of 2.0.
I think you're right about the report-writing avenue however. It's a
as what I'm trying to do would be ideally suited to generating a quickHTML
file and printing it, if only I could have slightly more control over theonly
printed output :-(
Thanks for your help,
Alex Clark
"Colin Neller" <cneller@xxxxxxxxx> wrote in message
news:OkLFEw4QGHA.5500@xxxxxxxxxxxxxxxxxxxxxxx
Alex,
Print Templates are certainly non-trivial, but they do not require C++.
The key line of code from the example I gave is:
pCmdTarg->Exec(&CGID_MSHTML,
IDM_PRINT,
OLECMDEXECOPT_PROMPTUSER,
&vTemplatePath,
NULL);
Basically, what you would do in .NET is cast your IWebBrowser2 object to
an IOleCommandTarget and call the Exec method (as above) passing in the
path to your print template (vTemplatePath in the above example.) The
vast majority of the Print Template code will be written in JavaScript.
Honestly, I think you would be better investing in a report writing tool
(e.g. ActiveReports) The path you are headed down with the WB is not an
easy one.
--
Colin Neller
http://www.colinneller.com/blog
"Alex Clark" <honeycomb@xxxxxxxxxxxxxxxxx> wrote in message
news:%238dKtk4QGHA.2436@xxxxxxxxxxxxxxxxxxxxxxx
Hi Colin,
These look really useful but the article seems to imply that this is
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/htmlpossible when using C++. I know it was written a long time ago (before
.NET) but it doesn't seem as though it could be very VB.NET friendly :-(
Thanks,
Alex
"Colin Neller" <cneller@xxxxxxxxx> wrote in message
news:e68kZa4QGHA.2536@xxxxxxxxxxxxxxxxxxxxxxx
Alex,
I suggest you look into Print Templates:
/beyondprintpreview.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/html
/printtemplate2.asp?frame=true
a
--
Colin Neller
http://www.colinneller.com/blog
"Alex Clark" <honeycomb@xxxxxxxxxxxxxxxxx> wrote in message
news:%235I1TE4QGHA.2156@xxxxxxxxxxxxxxxxxxxxxxx
Greetings,
(.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs).
I've decided to take advantage of the layout characteristics of HTML
documents to simplify my printing tasks, but of course it's thrown up
andwhole host of new issues...
I'm generating a multi page printable document in HTML from my app,
CSSdisplaying it in a WebBrowser control. I've looked into using some
MSDNcommands to control pagination, but nothing seems to fit the bill so
far.
I need to include a custom header/footer (imported from another HTML
file) on every page that's printed. I also need to draw a border
around each page. The closest I can get to the border is putting all
my print-content inside an HTML table, which looks ugly because it
doesn't close off at the foot of each page - it only draws its final
horizontal line at the very end of the document.
I tried inheriting from WebBrowser and overriding the OnPrint event,
but this never seems to get called? I've found an example on the
site, but it's all in C++ and seems designed around MFC.
How can I hang on to the snazzy built-in formatting features of HTML,
but still have control over the printed output & pagination? Help!
Thanks in advance,
Alex Clark
.
- References:
- WebBrowser Control Printing
- From: Alex Clark
- Re: WebBrowser Control Printing
- From: Colin Neller
- Re: WebBrowser Control Printing
- From: Alex Clark
- Re: WebBrowser Control Printing
- From: Colin Neller
- Re: WebBrowser Control Printing
- From: Alex Clark
- WebBrowser Control Printing
- Prev by Date: Re: Edit and Continue?? VS2005
- Next by Date: Re: Distributing Application / SQL Server Express question
- Previous by thread: Re: WebBrowser Control Printing
- Next by thread: Re: WebBrowser Control Printing
- Index(es):
Relevant Pages
|