webBrowser

Can is save the webpage from the webbrowser i mean with all his images not links to the imagest
Like Ms Word does in Internet explorer



Answer this question

webBrowser

  • Blast

    Do you want to save a web page it's content

  • gsm

    thanks ..

    but can you explain please the code


  • Scott Sackville

    add COM reference to Microsoft Internet Controls. . .

    use this code:


    SHDocVw.
    InternetExplorer ie = (SHDocVw.InternetExplorer)
    webBrowser1.ActiveXInstance;
    object pvaIn = "";
    object pvaOut = null;
    ie.ExecWB(SHDocVw.
    OLECMDID.OLECMDID_SAVEAS,
    SHDocVw.
    OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER,
    ref pvaIn, ref pvaOut);



  • Daniel Jakobsson

    Gotta go to school. See ya later..

    Thanks again to all that are helping me!!


  • barkingdog

    You can download the html content to a local file on the hard drive or other place.

    Now you lookup the html file and download all the images to the same directory or sub-directory.
    The hard part is that you now need to modify the html so it will load the local stored images. This can be done with the String methods and/or Regex.



  • Claudio Cannatella

    Don't be affraid, it is a hard but fun part!

    You must search the html content for the image tag (<img) and get the url of it. The url /images/top.gif will be the full folder url to the html page with this part appended to it.
    So, if you have the html page: http://www.bankbuddyonline.nl/index.html
    You will find one image tag with the src attribute set to Images/bbo.gif. When you want to grap that image you need to download it with the full url and that would be http://www.bankbuddyonline.nl/Images/bbo.gif.

    Enjoy your school and lett us know when it worked out or you need any help!


  • Obi Joe Kenobi

    yes.. Like Office 2003 and office 12 does...

    He saves all the images and text like an .doc file...

    When the webbrowser finish loading the webpage... and shows the webpage with all her images.. he must save somewhere the data.. a file or stream or memory stream.




  • RSDEVELOPER

    ya i thought that too... but from that i was affraid

    I managed to save the html content in a memory stream...
    and created a .html file. It worked but no images..

    What i dont know is how can i download a image
    lest say that in my html file i have this:

    <img src="/images/top.gif"> how will i be able to download this image


  • Syeda Rizvi

    zapacila89 wrote:
    thanks ..

    but can you explain please the code

    cast the ActiveXInstance property of the webbrowser control to an instance of Internet explorer. And invoke the OLE Automation method ExecWB passing the "Save As" constant with the prompt user option. you can pass an empty string for the path as you are prompting the user for it.

    http://msdn.microsoft.com/library/default.asp url=/workshop/browser/webbrowser/reference/Methods/ExecWB.asp

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/com/html/ae1592b6-2afd-4379-a18e-d46b226bc9e2.asp

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/com/html/6245725e-51d4-40e1-8cf1-a65657e790ef.asp

    Download and run the code here



  • MarkAx

    I use WebBrowser 2.0 component to edit an html page .After editing, I want to save this page. How can I save my web page (SAVE, not SAVE AS).


  • webBrowser