本文主要是介绍用C#逐个读取EXCEL单元格内容,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
用C#逐个读取EXCEL单元格内容
Microsoft.Office.Interop.Excel.Application xApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
Microsoft.Office.Interop.Excel.Workbook xBook1 = xApp.Workbooks._Open(this.textBox1.Text,
Missing.Value, Missing.Value, Missing.Value, Missing.Value
, Missing.Value, Missing.Value, Missing.Value, Missing.Value
, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
Missing.Value, Missing.Value, Missing.Value, Missing.Value
, Missing.Value, Missing.Value, Missing.Value, Missing.Value
, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
Microsoft.Office.Interop.Excel.Worksheet xSheet1;
Microsoft.Office.Interop.Excel.Range xRange1;
xSheet1 = (Microsoft.Office.Interop.Excel.Worksheet)xBook1.Sheets[1];
Microsoft.Office.Interop.Excel.Range xRange1;
xSheet1 = (Microsoft.Office.Interop.Excel.Worksheet)xBook1.Sheets[1];
for (int row = 1; row <= 300; row++)
{
xRange1 = xSheet1.get_Range(string.For
xRange1 = xSheet1.get_Range(string.Format("A{0}", row), string.Format("G{0}", row));
{
xRange1 = xSheet1.get_Range(string.For
xRange1 = xSheet1.get_Range(string.Format("A{0}", row), string.Format("G{0}", row));
}
xSheet1 = null;
xBook1 = null;
xApp.Quit();
xApp = null;
这篇关于用C#逐个读取EXCEL单元格内容的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!