Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Printing .html files in vb

Options
  • 11-03-2003 2:29pm
    #1
    Closed Accounts Posts: 7,230 ✭✭✭


    Hey again. My question this time is, is it possible to print .html files in vb without using the WebBrowser control. Basically i have read a table from my database and converted it to html. Before i print it i do:

    Shell "c:\program files\internet explorer\iexplore.exe h:\vb\projecttest\rs.html", vbNormalFocus

    So internet explorer is launched and the user can see what the format of the output will be before it's printed. Now i know the user could just goto file-> print / ctrl+p inside internet explorer. I don't want that to happen, I want it to be as free flowing as possible. I know how to print the contents of text files, but if i use that method on a .html file it will print the source of the .html file right?

    I am encouraging your input on this one. I feel the method is somewhat silly and would like to hear your comments and if you think there is a better way i should be going about doing this. If you want me to post more code i can.


Comments

  • Closed Accounts Posts: 8,264 ✭✭✭RicardoSmith


    Whats your problem with the brower control. Seems like you are trying to avoid the one thing that does exactly what you want. But perhaps I'm misinterpreting the the question.


  • Registered Users Posts: 2,781 ✭✭✭amen


    you could launch IE in the background (hide it) and pass it the htm page and the used a send keys to print the page
    that way you will print the page as rendered by ie


  • Closed Accounts Posts: 8,264 ✭✭✭RicardoSmith


    You can just use it as an object in VB anyway, and create your own form around it.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    I think I've misunderstood the question too. Are you displaying the HTML page so the user can verify the contents or verify the format of the contents? If its the format then I don't see the point unless the user can edit the format before printing (which they may be able to do, you just haven't mentioned it). However if its just to verify the contents then its a good idea.

    I would go with what ricardo said and use the browser control to create your own form. You could do it like print preview in IE or Word using the same look and feel. Users always like to see something familiar. Damned users :p

    You maybe able to launch IE with Print Preview mode but I had a quick look and couldn't find a way. I'm going to investigate ...


  • Closed Accounts Posts: 7,230 ✭✭✭scojones


    Originally posted by Evil Phil
    I think I've misunderstood the question too. Are you displaying the HTML page so the user can verify the contents or verify the format of the contents? If its the format then I don't see the point unless the user can edit the format before printing (which they may be able to do, you just haven't mentioned it). However if its just to verify the contents then its a good idea.

    I would go with what ricardo said and use the browser control to create your own form. You could do it like print preview in IE or Word using the same look and feel. Users always like to see something familiar. Damned users :p

    You maybe able to launch IE with Print Preview mode but I had a quick look and couldn't find a way. I'm going to investigate ...

    It's to verify the contents. I have went with what ricardo said and i am using the WebBrowser control. It works like a charm. The reason i didn't want to go with the WebBrowser control in the first place was because i would have had to build the form (i don't have much time) but i got up off my rear end and did just that. I'm actually surprised at how easy the WebBrowser control is to use. Thanks ricardo and friends. Boards.ie to my rescue once again :)


  • Advertisement
  • Closed Accounts Posts: 8,264 ✭✭✭RicardoSmith


    Its a handy way to do a visual check on xml files/data too.


Advertisement