using System.Collections;
using Microsoft.Office.Interop.Excel;
using System;
using System.Reflection;
class Sample
{
static void Main()
{
string file = @"c:\csnet\jap\ex1\sample1.xls";
Microsoft.Office.Interop.Excel.ApplicationClass ap = new ApplicationClass();
Missing m=Missing.Value;
Workbook wb=ap.Workbooks.Open(file, m, m, m, m, m, m, m, m, m, m, m, m, m, m);
Worksheet sh =(Worksheet) wb.Sheets[1];
for (int i = 1; i < 10; i++)
{
string[] p = new string[10];
for (int j = 1; j <= 10; j++)
{
Range r = (Range)sh.Cells[i, j];
p[j - 1] = r.Value2;
}
}
ap.Quit();
}
}