Setting a stylesheet in AxWebBrowser control
-
Hi I'm using a WebBrowser object in my form to display the results of a Dataset. All is good in formatting the html into a table, but I'm seeming stuck with the standard stylesheet - Times Font and all the other defaults. How can a set a stylesheet when I set the HTML data? Saving the report to a temporary file and navigating to it causes the control to use the stylesheet defined in the file, but I don't want to do it that way, I want to set the text and set the stylesheet all with my program. Cheers Dave
-
Hi I'm using a WebBrowser object in my form to display the results of a Dataset. All is good in formatting the html into a table, but I'm seeming stuck with the standard stylesheet - Times Font and all the other defaults. How can a set a stylesheet when I set the HTML data? Saving the report to a temporary file and navigating to it causes the control to use the stylesheet defined in the file, but I don't want to do it that way, I want to set the text and set the stylesheet all with my program. Cheers Dave
Check out the following: IHTMLDocument2::styleSheets[^], you will need to wrap MSHTML however, this is discussed here[^] - Nick Parker
My Blog | My Articles -
Check out the following: IHTMLDocument2::styleSheets[^], you will need to wrap MSHTML however, this is discussed here[^] - Nick Parker
My Blog | My ArticlesAs far as I can tell that returns a read-only collection of stylesheet - if the page had a stylesheet to begin with I could possibly alter it, but not add to them I did manage a sort-of work around using the createStyleSheet method of msthml.HTMLDocumentClass. It does mean having to have the stylesheet in a file rather than generate it, but it does what I need it to.
-
Check out the following: IHTMLDocument2::styleSheets[^], you will need to wrap MSHTML however, this is discussed here[^] - Nick Parker
My Blog | My ArticlesJust to let you know, Microsoft.mshtml.dll comes with VS.NET, IIRC, which is far better to use than creating your own since it's the PIA (primary interop assembly) produced by Microsoft. I think it also comes with Office, but I'm honestly not sure. Just letting you know. :) This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]
-
Just to let you know, Microsoft.mshtml.dll comes with VS.NET, IIRC, which is far better to use than creating your own since it's the PIA (primary interop assembly) produced by Microsoft. I think it also comes with Office, but I'm honestly not sure. Just letting you know. :) This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]
Thanks, I will keep that in mind the next time a similar question is asked here. ;) - Nick Parker
My Blog | My Articles