So you have a template but can't get it to load correctly? You should only have the path in a string... you don't need it to flatten and convert to a variant, you should be able to wire the string control directly to
pvaIn of the
IWebBrowser2 method. I have no idea if you could gain information from
pvaOut (wouldn't that be convenient).
For the other two arguments I used:
OLECMDID_PRINTPREVIEW
OLECMDEXECOPT_PROMPTUSER
For my templates I just took the default IE template instead of trying to make one from scratch--that was a lot easier. Below are my notes. I cannot attach code at the moment, which I used for parts of the process, such as testing, compiling to an .mht archive, and stripping comments. Basically once I pulled out all the default IE files though I modified the template to look like I wanted, then compiled everything into an .mht file (using my own LabVIEW code) which served as a single-file print template which could be passed to
pvaIn------------
To make a print template:
- Copy IE Default.html to a working copy
Using the Shell Document Object and Control Library (SHDOCLC.DLL)...
- From IE, retrieve the print-preview dialog:
res://shdoclc.dll/preview.dlg
- When the dialog loads, go to Menu > View > Source
- Save the source code to a directory.
- Extract the necessary images needed using the syntax:
res://shdoclc.dll/image.gif
- Make edits
- Run labview activex code to see if it works
- Once it works, compile to .mht
- Don't delete originals
- Strip comments ... mhtml converter doesn't work quite right like IE does so the comments can mess it up
- Make sure to include Optional Content of all "*.gif" files
- Run report tester with new .mht file and make sure to include "mhtml:" before "C:\blah blah blah\whatever.mht"
(ie, "mhtml:C:\blah blah...)
Remember when testing .mht files that IE will cache the decompressed files and may not update them.
Changing the name will make it reload a fresh file. Cache is cleared (I think) when LabVIEW is restarted.