OpenXML for excel,foreach cell和row

时间:2014-12-08 03:05:18

标签: excel openxml

我有一个excel文件,结构如下所示。课程单元是无限的,可以是一个单元,也可以是十个单元。如何获取当前单元格索引和行索引?

A, B, C, D, E, F, G, H, ..., ..., .......
ID, name, age, course1, course2, course3, course4..., course.......
1, peter, 14, Yes, null, No, null.....
2, tom, 20, No, Yes, null, null...
3, john, 30, Yes, null, no, null...

foreach (Cell c in cells) {
    //get the current cell index
    // if the c.header > D
    foreach (Row row in c.Elements<Row>())
        {
               //get the current row index
               //get the id value of current rowid
               //get the name value of current rowid
               //get the course value of current rowid
        }
}

感谢。

0 个答案:

没有答案