|
-
Feb 26th, 2001, 11:21 AM
#1
Hello,
i have a table that was created in HTML.
How can i remove the HTML tags from the file inorder to read it like a simpel text file? i.e every line in the file will contain a cell from the table.
tnx and god bless
-
Feb 27th, 2001, 12:49 PM
#2
Fanatic Member
Create a project with the following references:
- Microsoft Internet Controls
- Microsoft HTML Object Library
Then put the following controls on the form
- Textbox 'Text1', multirow, both scrollbars
- WebBrowser 'WebBrowser1'
Run the project with F5
Code:
Private Sub Form_Load()
On Error Resume Next
Me.Show
StartingAddress = "http://www.microsoft.com/"
If Len(StartingAddress) > 0 Then
Text1.Text = StartingAddress
'try to navigate to the starting address
WebBrowser1.Navigate StartingAddress
End If
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
On Error Resume Next
If (pDisp Is WebBrowser1.Object) Then
'DocumentComplete event is fired for each frame on a page
'this condition means that the main document is fully loaded
'and you can use brwWebBrowser.Document property
Text1.Text = ""
DisplayText WebBrowser1.Document
End If
End Sub
Private Sub DisplayText(ByVal iDoc As HTMLDocument)
Dim Frame As HTMLFrameElement
Dim Range As IHTMLTxtRange
Dim Title As String
Dim TextInfo As String
On Error Resume Next
Title = iDoc.Title
If Title = "" Then
Title = iDoc.parentWindow.Name
End If
TextInfo = "Title: " & Title & " {" + vbCrLf
'check to see if the document has a BODY
If iDoc.body.tagName = "BODY" Then
'use the text range object to get text out of BODY
Set Range = iDoc.body.createTextRange
TextInfo = TextInfo & Range.Text & vbCrLf
Set Range = Nothing
End If
Text1.Text = Text1.Text & TextInfo & "}" & vbCrLf
'recurse all the frames
For Each Frame In iDoc.frames
DisplayText Frame.Document
Next
End Sub
This is very simple, so will need some additional coding to finish.
Hope this helps
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|