Parsing HTML Table in C#

后端 未结 3 1727
深忆病人
深忆病人 2020-12-02 14:17

I have an html page which contains a table and i want to parse that table in C# windows form

http://www.mufap.com.pk/payout-report.php?tab=01

3条回答
  •  误落风尘
    2020-12-02 14:35

    Do you mean something like this ?

    foreach (HtmlNode table in doc.DocumentNode.SelectNodes("//table")) {
        ///This is the table.    
        foreach (HtmlNode row in table.SelectNodes("tr")) {
        ///This is the row.
            foreach (HtmlNode cell in row.SelectNodes("th|td")) {
                ///This the cell.
            }
        }
    }
    

提交回复
热议问题