我尝试用C#应用程序读取Excel文件。到目前为止它工作正常,我可以选择一行并读取值:
Excel.Worksheet ws = (Excel.Worksheet)sheets.get_Item("Table1");
Range range = ws.UsedRange;
Excel.Range currentRangeCells = ws.get_Range("F3", "F" + range.Rows.Count);
System.Array dataArray = (System.Array)currentRangeCells.Cells.Value2;
for (int i = 1; i < dataArray.Length; i++)
{
if (dataArray == null)
continue;
if (dataArray.GetValue(i, 1) == null)
continue;
Debug.Write(i.ToString() + ": Value1" + dataArrayValue1.GetValue(i, 1) + "\r\n");
}
有没有办法获得Cell信息呢?我想保存值以及值在哪个单元格中,或者至少在值的哪一行中保存。