c#excel怎么读取一列 没有限制的
1个回答
2017-01-28 · 知道合伙人互联网行家
关注
展开全部
这个是需要代码的
get_Range("A:A",Missing.Value)Application xl = new Application();
Workbook wb = xl.Workbooks.Open(
netpath, 0, false, 5,
System.Reflection.Missing.Value, System.Reflection.Missing.Value, false,
System.Reflection.Missing.Value, System.Reflection.Missing.Value, true, false,
System.Reflection.Missing.Value, false, false, false);//Open the excel sheet
Sheets xlsheets = wb.Sheets; //Get the sheets from workbook
Worksheet excelWorksheet = (Worksheet)xlsheets[1]; //Select the first sheet
Range excelCellnumero = (Range)excelWorksheet.get_Range("A1:A50", Type.Missing); //Select a range of cells
Range excelCellnom = (Range)excelWorksheet.get_Range("B1:B50", Type.Missing);
System.Array valuesNumero = (System.Array)excelCellnumero.Cells.Value2; //Assign it to an array
System.Array valuesNom = (System.Array)excelCellnom.Cells.Value2;
xl.Quit();
get_Range("A:A",Missing.Value)Application xl = new Application();
Workbook wb = xl.Workbooks.Open(
netpath, 0, false, 5,
System.Reflection.Missing.Value, System.Reflection.Missing.Value, false,
System.Reflection.Missing.Value, System.Reflection.Missing.Value, true, false,
System.Reflection.Missing.Value, false, false, false);//Open the excel sheet
Sheets xlsheets = wb.Sheets; //Get the sheets from workbook
Worksheet excelWorksheet = (Worksheet)xlsheets[1]; //Select the first sheet
Range excelCellnumero = (Range)excelWorksheet.get_Range("A1:A50", Type.Missing); //Select a range of cells
Range excelCellnom = (Range)excelWorksheet.get_Range("B1:B50", Type.Missing);
System.Array valuesNumero = (System.Array)excelCellnumero.Cells.Value2; //Assign it to an array
System.Array valuesNom = (System.Array)excelCellnom.Cells.Value2;
xl.Quit();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询