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. AxWebBrowser - create a document on the fly?

AxWebBrowser - create a document on the fly?

Scheduled Pinned Locked Moved C#
htmlwinformsquestion
6 Posts 5 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.
  • R Offline
    R Offline
    Radoslav Bielik
    wrote on last edited by
    #1

    Hi everyone, I have a AxSHDocVw.AxWebBrowser on a Form in my Windows Forms application. Now, is it possible somehow to create an HTML document on the fly (programmatically from my Windows Forms application) that will be displayed instead of navigating to an existing document using AxWebBrowser.Navigate(...)? Thanks for any clues in advance! Rado

    M 1 Reply Last reply
    0
    • R Radoslav Bielik

      Hi everyone, I have a AxSHDocVw.AxWebBrowser on a Form in my Windows Forms application. Now, is it possible somehow to create an HTML document on the fly (programmatically from my Windows Forms application) that will be displayed instead of navigating to an existing document using AxWebBrowser.Navigate(...)? Thanks for any clues in advance! Rado

      M Offline
      M Offline
      MrEyes
      wrote on last edited by
      #2

      Funnily enough I was doing this very same thing today. I couldnt find a way to, for example, pass in a HTML string and get the browser to render it. So, using the data from the form components I created a HTML string and used a FileStream to write the this to a temporary file, I then used : object obj = null; myBrowser.Naviagate(pathToFile, ref obj, ref obj ref ob ref obj, ref obj) Note : I may have not typed in the right amount of "ref obj" as I am doing this from memory. post.mode = postmodes.signature; SELECT everything FROM everywhere WHERE something = something_else; > 1 Row Returned > 42

      M 1 Reply Last reply
      0
      • M MrEyes

        Funnily enough I was doing this very same thing today. I couldnt find a way to, for example, pass in a HTML string and get the browser to render it. So, using the data from the form components I created a HTML string and used a FileStream to write the this to a temporary file, I then used : object obj = null; myBrowser.Naviagate(pathToFile, ref obj, ref obj ref ob ref obj, ref obj) Note : I may have not typed in the right amount of "ref obj" as I am doing this from memory. post.mode = postmodes.signature; SELECT everything FROM everywhere WHERE something = something_else; > 1 Row Returned > 42

        M Offline
        M Offline
        Mr Rogers
        wrote on last edited by
        #3

        What you're both going to need to learn to use is MSHTML. Which is basically DHTML. So if you already know DHTML it makes it really easy. If you don't know DHTML but you understand XML, then you shouldn't have too many problems. So what you're going to need to do is get ahold of the Body element of the Document page and insert the HTML that you need by either creating the elements on the fly which is the most correct way, or by doing something like body.InnerHTML = "my html stuff". If this doesn't make any sense I'll try to find you some links that I used to learn it.

        N R 2 Replies Last reply
        0
        • M Mr Rogers

          What you're both going to need to learn to use is MSHTML. Which is basically DHTML. So if you already know DHTML it makes it really easy. If you don't know DHTML but you understand XML, then you shouldn't have too many problems. So what you're going to need to do is get ahold of the Body element of the Document page and insert the HTML that you need by either creating the elements on the fly which is the most correct way, or by doing something like body.InnerHTML = "my html stuff". If this doesn't make any sense I'll try to find you some links that I used to learn it.

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

          Navigating to a local file is fine, in fact, Reflector used to do this in a version a while ago (I haven't checked to see how Lutz is doing it now). - Nick Parker
          My Blog | My Articles

          1 Reply Last reply
          0
          • M Mr Rogers

            What you're both going to need to learn to use is MSHTML. Which is basically DHTML. So if you already know DHTML it makes it really easy. If you don't know DHTML but you understand XML, then you shouldn't have too many problems. So what you're going to need to do is get ahold of the Body element of the Document page and insert the HTML that you need by either creating the elements on the fly which is the most correct way, or by doing something like body.InnerHTML = "my html stuff". If this doesn't make any sense I'll try to find you some links that I used to learn it.

            R Offline
            R Offline
            Radoslav Bielik
            wrote on last edited by
            #5

            That's the way I went in the end, because I didn't want to write to a temporary file each time. I have created an HTML template document with a few elements, like a header and text field, and then used MSHTML to locate these elements and set their innerHTML attributes. Looked like a more elegant way for my purpose. :) If anyone needs the code, I can post it here, it was just a few lines. Rado

            J 1 Reply Last reply
            0
            • R Radoslav Bielik

              That's the way I went in the end, because I didn't want to write to a temporary file each time. I have created an HTML template document with a few elements, like a header and text field, and then used MSHTML to locate these elements and set their innerHTML attributes. Looked like a more elegant way for my purpose. :) If anyone needs the code, I can post it here, it was just a few lines. Rado

              J Offline
              J Offline
              Judah Gabriel Himango
              wrote on last edited by
              #6

              And of course you can just navigate to "about:blank" and it will load an empty document immediately. Judah Himango

              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