Build a string from a certain column in html table (using < table, < tr, and < td) into 1 string.
Can return only text from that column, or the full HTML structure.
Caller can pass which column, and if needed a certain word to start from and certain word to end with.
Starting from row having the word "StartingWord" in that same column
Stopping at row having the word "StopAtWord" in that same column
Return column from all rows including that 1st row with "StartingWord", excluding row having "StopAtWord"
Function Concatenate_HTMLColumn(FullHTMLTable, ColumnID, Optional StartingWord = "", Optional StopAtWord = "", Optional ReturnHTML = 1)
' Reads and concatenate the full HTML or non-HTML of column (ColumnID) from a, HTML table
' Starting from row having the word "StartingWord" in that same column
' Stopping at row having the word "StopAtWord" in that same column
' Return column from all rows including that 1st row with "StartingWord", excluding row having "StopAtWord"
Rett = ""
X1 = 1
AddMe = 0
If StartingWord = "" Then AddMe = 1
For Each Row1 In Split(FullHTMLTable, " <tr")
If X1 = 1 Then GoTo NextRow ' we do not need to read 1st findings, because it is before 1st table
Row2 = " <tr" & CutString(Row1, , " </tr >") & " </tr >" ' Full HTML row
ColOfID = CutString3(Row2, ColumnID + 1, " <td")
If ColOfID = Row2 Then GoTo NextRow
If AddMe = 0 And StartingWord > "" And VBInstr(StartingWord, ColOfID) > 0 Then AddMe = 1
If AddMe = 1 And StopAtWord > "" And VBInstr(StopAtWord, ColOfID) > 0 Then Exit For
If AddMe = 1 Then Rett = Rett & " " & CutString(ColOfID, " >", " </td")
NextRow:
DoEvents
X1 = X1 + 1
Next
If ReturnHTML = 0 Then Rett = RemoveHTMLTags(Rett)
Concatenate_HTMLColumn = Rett
End Function
' Reads and concatenate the full HTML or non-HTML of column (ColumnID) from a, HTML table
' Starting from row having the word "StartingWord" in that same column
' Stopping at row having the word "StopAtWord" in that same column
' Return column from all rows including that 1st row with "StartingWord", excluding row having "StopAtWord"
Rett = ""
X1 = 1
AddMe = 0
If StartingWord = "" Then AddMe = 1
For Each Row1 In Split(FullHTMLTable, " <tr")
If X1 = 1 Then GoTo NextRow ' we do not need to read 1st findings, because it is before 1st table
Row2 = " <tr" & CutString(Row1, , " </tr >") & " </tr >" ' Full HTML row
ColOfID = CutString3(Row2, ColumnID + 1, " <td")
If ColOfID = Row2 Then GoTo NextRow
If AddMe = 0 And StartingWord > "" And VBInstr(StartingWord, ColOfID) > 0 Then AddMe = 1
If AddMe = 1 And StopAtWord > "" And VBInstr(StopAtWord, ColOfID) > 0 Then Exit For
If AddMe = 1 Then Rett = Rett & " " & CutString(ColOfID, " >", " </td")
NextRow:
DoEvents
X1 = X1 + 1
Next
If ReturnHTML = 0 Then Rett = RemoveHTMLTags(Rett)
Concatenate_HTMLColumn = Rett
End Function
FullHTMLTable, ColumnID, Optional StartingWord = "", Optional StopAtWord = "", Optional ReturnHTML = 1
Views 746
Downloads 58
CodeID
DB ID