Worksheet worksheet1 = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Sheets[1]; var itemset2 = webBrowser1.Document.GetElementById("t2"); string str = ""; int rowCount = itemset2.GetElementsByTagName("tr").Count; int colCount = itemset2.GetElementsByTagName("tr")[0].GetElementsByTagName("td").Count; for (var i = 0; i < rowCount; i++) { for (var j = 0; j < colCount; j++) { str = itemset2.GetElementsByTagName("tr")[i].GetElementsByTagName("td")[j].InnerText; worksheet1.Cells[i + 1, j + 1] = str; } }
<div id="t2" class="tblcss"> <table width="100%" cellpadding="0" cellspacing="0"> <tr id=r1> <td>Telephony By Country</td> <td>Jan-2013</td> <td>Feb-2013</td> <td>Mar-2013</td> </tr> <tr id=r2> <td class="tdhighlight">Calls Offered</td> <td>33555</td> <td>28201</td> <td>27563</td> </tr> <tr id=r3> <td class="tdhighlight">Calls Answered</td> <td>32042</td> <td>27030</td> <td>26273</td> </tr> <tr id=r4> </table> </div>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)