Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Setting a stylesheet in AxWebBrowser control

Setting a stylesheet in AxWebBrowser control

Scheduled Pinned Locked Moved C#
htmlhelpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cheesepirate
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • C cheesepirate

      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

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      Check out the following: IHTMLDocument2::styleSheets[^], you will need to wrap MSHTML however, this is discussed here[^] - Nick Parker
      My Blog | My Articles

      C H 2 Replies Last reply
      0
      • N Nick Parker

        Check out the following: IHTMLDocument2::styleSheets[^], you will need to wrap MSHTML however, this is discussed here[^] - Nick Parker
        My Blog | My Articles

        C Offline
        C Offline
        cheesepirate
        wrote on last edited by
        #3

        As 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.

        1 Reply Last reply
        0
        • N Nick Parker

          Check out the following: IHTMLDocument2::styleSheets[^], you will need to wrap MSHTML however, this is discussed here[^] - Nick Parker
          My Blog | My Articles

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          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]

          N 1 Reply Last reply
          0
          • H Heath Stewart

            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]

            N Offline
            N Offline
            Nick Parker
            wrote on last edited by
            #5

            Thanks, I will keep that in mind the next time a similar question is asked here. ;) - Nick Parker
            My Blog | My Articles

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups