c#从excel文件中获取值列表

c#从excel文件中获取值列表,c#,string,excel,C#,String,Excel,我正在处理Excel文件的dll。 在dll中,我想做一个方法,在这个方法中,客户机将输入从中获取列表的行,然后输入从中获取列表的列和获取列表的列。 比如: public List GetValueList(int inRow,string from column,string to column) 问题是——我怎样才能做到这一点?在Excel中有“AZX”、“AA”等列。。。我不能只做“fromColumn++” 有什么想法吗?希望我能解释清楚。工作表对象的单元格成员将行数和列数都作为整数。所

我正在处理Excel文件的dll。 在dll中,我想做一个方法,在这个方法中,客户机将输入从中获取列表的行,然后输入从中获取列表的列和获取列表的列。 比如: public List GetValueList(int inRow,string from column,string to column)

问题是——我怎样才能做到这一点?在Excel中有“AZX”、“AA”等列。。。我不能只做“fromColumn++”


有什么想法吗?希望我能解释清楚。

工作表对象的
单元格
成员将行数和列数都作为整数。所以你可以这样做:

List<object> GetValueList(WorkSheet WS, int inRow, int fromColumn, int toColumn)
{
    List<object> MyList = new List<object>(toColumn - fromColumn + 1);
    for(int i=fromColumn; i<=toColumn; i++)
        MyList.Add(WS.Cells[inRow, i].Value);

    return MyList;
}
List GetValueList(工作表WS、int-inRow、int-from列、int-to列)
{
列表MyList=新列表(toColumn-fromColumn+1);
for(int i=fromColumn;i