Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetTable in tables with rowspan
#4
GetTable does not give row and column numbers. Need to find the table element, get its rows etc, it's not very easy.
Partial example:
Macro Macro2765
Code:
Copy      Help
out
str html=
;<!DOCTYPE html>
;<html>
;<head>
;<style>
;table, th, td {
;;;;;border: 1px solid black;
;}
;</style>
;</head>
;<body>
;
;<table>
;;;<tr>
;;;;;<th>Month</th>
;;;;;<th>Savings</th>
;;;;;<th>Savings for holiday!</th>
;;;</tr>
;;;<tr>
;;;;;<td>January</td>
;;;;;<td>$100</td>
;;;;;<td rowspan="2">$50</td>
;;;</tr>
;;;<tr>
;;;;;<td>February</td>
;;;;;<td>$80</td>
;;;</tr>
;;;<tr>
;;;;;<td>March</td>
;;;;;<td>$90</td>
;;;;;<td>$70</td>
;;;</tr>
;</table>
;
;</body>
;</html>


HtmlDoc d.InitFromText(html)
MSHTML.IHTMLElement2 e=+d.GetHtmlElement("table" 0)
if(e=0) end "not found"
;out e.innerHTML
MSHTML.IHTMLElement2 ee
foreach ee e.getElementsByTagName("tr")
,out ee.getElementsByTagName("td").length


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)