一个用于搜寻宗地编号的小程序
NodeCollection tables = mydoc.GetChildNodes(NodeType.Table, true);
//获取所有表格
封面表/
foreach (Aspose.Words.Tables.Table tablefd in tables)
{
if (tablefd != null)
{
if (tablefd.HasChildNodes)
{
if (tablefd.GetText().Contains("地址:"))
{
for (int i = 0; i < tablefd.Rows.Count; i++)
{
bool find = false;
for (int k = 0; k < tablefd.Rows[i].Cells.Count;k++)
{
if (find)
{ break; }
if
(tablefd.Rows[i].Cells[k].GetText().Replace("\a", "").Trim().Contains("编号:"))
{
zdbh = tablefd.Rows[i].Cells[k+1].GetText().Replace("\a", "").Trim()
+"*"+ tablefd.Rows[i+1].Cells[k + 1].GetText().Replace("\a", "").Trim()
+ "*" + Path.GetFileName(fileName);
find = true;
break;
}
}
}
//zdbh = table0.Rows[0].Cells[1].GetText().Replace("\a", "").Trim();
break;
}
}
}
}