Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18011
Number of posts: 55384

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Saving web page w/ formatting Posted by timothytrice on 22 May 2004 at 1:50 PM
I'm trying to take a simple text web site and save it to a file with the same format. My process now is to use the inet control, display the page on a label, frame, form, or richtext box (I've tried all methods). Some formating is still lost but it's tolerable. The problem is when I use the write method to write it to a text file, all formating is lost. if the web page is simple small text, it's tolerable, but if it contains a lot of text, the formatting is just too complicated to write a program to analyze it. Any suggestions? Thanks again to all who've helped.

Tim
Report
Re: Saving web page w/ formatting Posted by KDivad Leahcim on 22 May 2004 at 9:49 PM
: I'm trying to take a simple text web site and save it to a file with the same format. My process now is to use the inet control, display the page on a label, frame, form, or richtext box (I've tried all methods). Some formating is still lost but it's tolerable. The problem is when I use the write method to write it to a text file, all formating is lost. if the web page is simple small text, it's tolerable, but if it contains a lot of text, the formatting is just too complicated to write a program to analyze it. Any suggestions? Thanks again to all who've helped.
:
: Tim
:

If it's a webpage, show it in the WebBrowser control. Don't use the WB control to retrieve the page unless you've found out how to get the entire, original source from it (the only thing I've discovered is that it seems .Document.OuterHTML is supposed to be it, but I've never tried it).

WebBrowser1.Navigate "about:blank" 'clear it
WebBrowser1.Document.Write "html code here"


Or, since I don't remember if INet gives you the data (above) or saves it to a file (below):

WebBrowser1.Navigate "savedfile.html"


If you're writing to a "text file", you don't get formatting. "Text files" don't support it. If it's ASCII data (html, rtf, text, etc.), the Print method should print it faithfully. Otherwise, if it's binary data (Word, Unicode, etc.), use Put.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.