VB6/webbrowser control 
Author Message
 VB6/webbrowser control

Hello,
    I am using the WebBrowser control in a VB6 project. I use it to display
VB6 programmatically generated html reports from data gathered using
ADO/Access2K. Literally just creating html text in For/Next structures with
vbCRLF's and then saving it to a file with a .html extension and displaying
it in the webbrowser control. Or, using the WIN32API ShellExecute command to
either shell the file up in the machine's default html client or, using
"Print"  instead of "Open" in the ShellExecute function will not show the
html in the browser, but bring the same Print object up as IE uses. (Very
handy...)
My problem is this:
    The browser control inherits user-defined options from the machine's
local IE browser. I imbed in-line CSS pagebreaks in my html-text. When a
user sets the TextSize to anything but Medium in Internet Explorer, it
screws up the format of the printed report.
    I want to be able to programmatically set the TextSize to Medium. (Other
settings are Smaller, Smallest, Larger, Largest) I read an article in a vbpj
about instantiating the MSHTML object 'With Events'. I have done this in a
class module in my project. And it did expose 'a slew of other proerties and
methods to the object variable, like oncontextmenu, yada, yada.
    Anyway, I have found the property in the VB object browser. It is
hidden, but part of the MSHTML object but I am having trouble figuring out
how to connect it and my browser control or if I can.
    I have also tried the .EXECWB method of the browser control and found I
can cause Print Preview to come up for my users... (wb.ExecWB
OLECMDID_PRINTPREVIEW...)
    BUT, I can't find 'built-in' methods to control this TextSize property.
Can anyone out there help me?
Thanks,
Steve Rowell


Thu, 19 Aug 2004 02:29:29 GMT  
 VB6/webbrowser control
We use stylesheets.  You can set the exact font size.  Define them in the
header, then use the tags in the body.

Alternately, you can do this 'in-line'.  Like:
<DIV STYLE="font-size:8pt">
--Some text--
</DIV>

If you look up DHTML on MSDN, it has some examples.
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dh...
ml_node_entry.asp


Quote:
> Hello,
>     I am using the WebBrowser control in a VB6 project. I use it to
display
> VB6 programmatically generated html reports from data gathered using
> ADO/Access2K. Literally just creating html text in For/Next structures
with
> vbCRLF's and then saving it to a file with a .html extension and
displaying
> it in the webbrowser control. Or, using the WIN32API ShellExecute command
to
> either shell the file up in the machine's default html client or, using
> "Print"  instead of "Open" in the ShellExecute function will not show the
> html in the browser, but bring the same Print object up as IE uses. (Very
> handy...)
> My problem is this:
>     The browser control inherits user-defined options from the machine's
> local IE browser. I imbed in-line CSS pagebreaks in my html-text. When a
> user sets the TextSize to anything but Medium in Internet Explorer, it
> screws up the format of the printed report.
>     I want to be able to programmatically set the TextSize to Medium.
(Other
> settings are Smaller, Smallest, Larger, Largest) I read an article in a
vbpj
> about instantiating the MSHTML object 'With Events'. I have done this in a
> class module in my project. And it did expose 'a slew of other proerties
and
> methods to the object variable, like oncontextmenu, yada, yada.
>     Anyway, I have found the property in the VB object browser. It is
> hidden, but part of the MSHTML object but I am having trouble figuring out
> how to connect it and my browser control or if I can.
>     I have also tried the .EXECWB method of the browser control and found
I
> can cause Print Preview to come up for my users... (wb.ExecWB
> OLECMDID_PRINTPREVIEW...)
>     BUT, I can't find 'built-in' methods to control this TextSize
property.
> Can anyone out there help me?
> Thanks,
> Steve Rowell



Mon, 23 Aug 2004 06:03:54 GMT  
 VB6/webbrowser control
I was wondering if I could achieve this through the html, but I want to
affect the TextSize, not the FontSize. I will see if Text-Size works.
Many thanks!!!
Steve


Quote:
> We use stylesheets.  You can set the exact font size.  Define them in the
> header, then use the tags in the body.

> Alternately, you can do this 'in-line'.  Like:
> <DIV STYLE="font-size:8pt">
> --Some text--
> </DIV>

> If you look up DHTML on MSDN, it has some examples.

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dh...
Quote:
> ml_node_entry.asp



> > Hello,
> >     I am using the WebBrowser control in a VB6 project. I use it to
> display
> > VB6 programmatically generated html reports from data gathered using
> > ADO/Access2K. Literally just creating html text in For/Next structures
> with
> > vbCRLF's and then saving it to a file with a .html extension and
> displaying
> > it in the webbrowser control. Or, using the WIN32API ShellExecute
command
> to
> > either shell the file up in the machine's default html client or, using
> > "Print"  instead of "Open" in the ShellExecute function will not show
the
> > html in the browser, but bring the same Print object up as IE uses.
(Very
> > handy...)
> > My problem is this:
> >     The browser control inherits user-defined options from the machine's
> > local IE browser. I imbed in-line CSS pagebreaks in my html-text. When a
> > user sets the TextSize to anything but Medium in Internet Explorer, it
> > screws up the format of the printed report.
> >     I want to be able to programmatically set the TextSize to Medium.
> (Other
> > settings are Smaller, Smallest, Larger, Largest) I read an article in a
> vbpj
> > about instantiating the MSHTML object 'With Events'. I have done this in
a
> > class module in my project. And it did expose 'a slew of other proerties
> and
> > methods to the object variable, like oncontextmenu, yada, yada.
> >     Anyway, I have found the property in the VB object browser. It is
> > hidden, but part of the MSHTML object but I am having trouble figuring
out
> > how to connect it and my browser control or if I can.
> >     I have also tried the .EXECWB method of the browser control and
found
> I
> > can cause Print Preview to come up for my users... (wb.ExecWB
> > OLECMDID_PRINTPREVIEW...)
> >     BUT, I can't find 'built-in' methods to control this TextSize
> property.
> > Can anyone out there help me?
> > Thanks,
> > Steve Rowell



Mon, 23 Aug 2004 08:37:50 GMT  
 VB6/webbrowser control
To those that may be following this thread:

Kally Wang(MS) sent me this answer. And it is just exactly what I am looking
for.
Thanks Kally!!!

Q304103 HOWTO: Change the Font Size in a WebBrowser Control in a VB App
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q304103



Mon, 23 Aug 2004 22:27:23 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. VB6 webbrowser Control and Web base NT Login Automation

2. Memory leak in VB6 WebBrowser Control?

3. custom cursor in VB6 webbrowser control

4. VB6 : WebBrowser Control : Disablign JavaScript support

5. vb6 webbrowser control and html document

6. WebBrowser without WebBrowser Control in VB6 ?

7. WebBrowser control on VB6 control???

8. VB6 and WebBrowser control

9. HowTo: How do you change the fonts on the webbrowser control in VB6

10. Interacting with Frames in WebBrowser Control of VB6

11. VB6: supporting documentation for Webbrowser control?

12. Control WebBrowser from VB6

 

 
Powered by phpBB® Forum Software