class Program |
{ |
static void Main( string [] args) |
{ |
try |
{ |
var sheet = ExcelHleper.ReadData( @"C:\Users\rht\Desktop\MouseWithoutBorders\读取的文件1.xls" , 0); |
ShowTableInf(sheet, new methodProcessData(Func)); |
|
} |
catch (Exception e) |
{ |
Console.WriteLine(e.Message); |
|
} |
Console.ReadKey(); |
} |
private delegate void methodProcessData(Object dtat); |
static void Func(Object data) |
{ |
Console.Write(data.ToString()+ "\t" ); |
} |
static void ShowTableInf(DataTable table,methodProcessData func) |
{ |
Console.WriteLine( "Rown Count is:" +table.Rows.Count); |
Console.WriteLine( "Column Count is:" +table.Columns.Count); |
|
Console.ReadKey(); |
foreach (DataRow curRow in table.Rows) |
{ |
Console.WriteLine( " " ); |
|
foreach (var item in curRow.ItemArray) |
{ |
func(item); |
} |
|
} |
} |