Aspose.Cells 导入excel数据,上下行对应读数据

 

using Aspose.Cells;

Workbook workbook = new Workbook("e:\\t.xls");
Cells cells = workbook.Worksheets[0].Cells;
var index = 0;
var num = 1;//caijiqibianhao
for (int i = 0; i < cells.MaxDataRow + 1; i++)
{
index++;
if (index % 3==0)
{
num++;
}
for (int j = 0; j < cells.MaxDataColumn + 1; j++)
{
string s1 = cells[i, j].StringValue.Trim();//第一格


for (var k=i+1;k< cells.MaxDataRow+1;k++)
{
for (int h = j; h < cells.MaxDataColumn + 1; h++)
{
string s2 = cells[i + 1, h].StringValue.Trim(); //第一格的下一行格子
var index2 = num;
break;
}
break;
}

}
i = i + 1;
}

 

posted @ 2020-09-07 14:35  南方卖菜  阅读(252)  评论(0编辑  收藏  举报