C#: Getting a cell's value with Excel.interop

前端 未结 3 2021
不知归路
不知归路 2021-01-13 21:29

I want to get the value of a cell from an excel file with a software in C#; NOT THE TEXT, because the text depend of the size of the column, and I must not change it myself,

3条回答
  •  走了就别回头了
    2021-01-13 21:55

    I have often found codes a little more complex than needed all over. Basically reading a cell is as simple as:

    Xl.Range rng = sheet.Cells[row, column] as Xl.Range;
    return rng.Value2;
    

提交回复
热议问题