Results 1 to 2 of 2

Thread: Saving HTML documents

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2001
    Location
    Finland
    Posts
    26

    Question Saving HTML documents

    I'm using webbrowser to for nagivation and displaying the contents of web pages. But how do I get webbrowser to save the pages onto disk and preferably without the HTML coding only ascii??

    Many thanks for any ideas,
    Eero

  2. #2
    Matthew Gates
    Guest
    Use this code to save a page:


    Code:
    Text1.Text = WebBrowser1.Document.documentElement.innerHTML
    Or this one to save the whole web site.


    Code:
    WebBrowser1.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_DODEFAULT

    And use this code to remove the tags.


    Code:
    Private Function Tagless(ByVal Text As String) As String
        Dim i As Integer
        Dim bInTag As Boolean
        Dim strTmpStr As String
    
        bInTag = False
        For i = 1 To Len(Text)
            If Not bInTag Then
                If Mid(Text, i, 1) <> "<" Then
                    strTmpStr = strTmpStr & Mid(Text, i, 1)
                Else
                    bInTag = True
                End If
            Else
                If Mid(Text, i, 1) = ">" Then
                    bInTag = False
                End If
            End If
        Next
    
        TagLess = strTmpStr
    End Function
    
    Private Sub Form_Load()
        Dim strHTML As String
        strHTML = "<HTML>" & _
                  "<HEAD>" & _
                  "<TITLE>Test Page</TITLE>" & _
                  "</HEAD>" & _
                  "<BODY>" & _
                  "Hello World!" & _
                  "</BODY>" & _
                  "</HTML>"
        MsgBox Tagless(strHTML)
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width