I need to traverse through an HTML document and detect the position of each tag so I can insert HTML elements when I reach specific positions, such as the bottom of a page (9x11 paper)
I am using the .NET web browser control. I cannot seem to get the code to figure out my current position. OffsetRectangle is dependent on the parent node position which is tripping my up. This is what I have so far:
Using wb As WebBrowser = wf.WebBrowser
wb.Navigate("about:blank")
wb.Document.Write(My.Computer.FileSystem.ReadAllText("D:\Temp\Base.html"))
Dim children As HtmlElementCollection = wb.Document.All
Dim currentPosition As Integer = 0
For Each child As HtmlElement In children
currentPosition += child.OffsetRectangle.Top
If currentPosition > pagebottom Then
Stop
End If
Next
End using
How can I loop through every html tag and always know where I am verticaly?