㈠ 如何提取和保存網頁中的表格

最簡單的方法,右鍵點你要的表格,選導出到Microsoft office excel,就可以了。

㈡ 如何獲取網頁表格里的數據

this.webBrowser1.Document.GetElementById("username").InnerText

就是獲取這個控制項的值

///////////////////C:a.htm///////////////////

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<head>

<title>UntitledPage</title>

</head>

<body>

<tableid="table1">

<thead>

<tr>

<th>

ID

</th>

<th>

Name

</th>

<th>

Memo

</th>

</tr>

</thead>

<tbody>

<tr>

<td>

100

</td>

<td>

aaa

</td>

<td>

123

</td>

</tr>

<tr>

<td>

101

</td>

<td>

bbb

</td>

<td>

456

</td>

</tr>

<tr>

<td>

102

</td>

<td>

ccc

</td>

<td>

789

</td>

</tr>

<tr>

<td>

104

</td>

<td>

ddd

</td>

<td>

000

</td>

</tr>

</tbody>

</table>

</body>

</html>

/////////////////////form1.cs//////////////////

在form1中拖一個webbrowser,一個listview,和一個button

設置listview的視圖為Details

//按鈕事件

privatevoidbutton1_Click(objectsender,EventArgse)

{

this.webBrowser1.Url=newUri(@"File:\C:a.htm");

}

//webbrowser事件

privatevoidwebBrowser1_DocumentCompleted(objectsender,)

{

HtmlElementhe=this.webBrowser1.Document.GetElementById("table1");

intcolumns=he.FirstChild.FirstChild.Children.Count;

for(inti=0;i<columns;i++)

{

this.listView1.Columns.Add(he.FirstChild.FirstChild.Children[i].InnerText);

}

introws=he.Children[1].Children.Count;

for(intj=0;j<rows;j++)

{

this.listView1.Items.Add(he.Children[1].Children[j].Children[0].InnerText);

for(intk=1;k<columns;k++)

{

this.listView1.Items[j].SubItems.Add(he.Children[1].Children[j].Children[k].InnerText);

}

}

}

㈢ 網頁源文件中提取EXCEL表格的方法

可以用我們安全瀏覽器的插件來導出excel文件

㈣ 如何提取網頁上表格中的數據,望大俠指點

如果你想獲取結構化的表格數據,並且不斷獲取新增數據的話,還得用上工具輔專助,目前博 為小 幫軟屬件機器人對網頁或者軟體商各種可見數據都能方便採集下來,採集後輸出的也是結構化的表格。表結構可以根據你對應的Excel表格來一一設置,一次設置好後,可以實現長期一鍵採集數據,每次採集後輸出的表格,就是數據更新後的Excel表格了