http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=30258
http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=855

解决方案 »

  1.   

    google 输入 “c# 操作 excel”
      

  2.   

    Application exc = new Application();
    if (exc == null) {
    Console.WriteLine("ERROR: EXCEL couldn't be started");
    return 0;
    }
    exc.set_Visible(0, true); 
    Workbooks workbooks = exc.Workbooks; 
    _Workbook workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet, 0); _Worksheet worksheet = (_Worksheet) sheets.get_Item(1);
    if (worksheet == null) {
    Console.WriteLine ("ERROR in worksheet == null");
    }Range range1 = worksheet.get_Range("C1", Missing.Value);
    if (range1 == null) {
    Console.WriteLine ("ERROR: range == null");
    }
    const int nCells = 1;
    Object[] args1 = new Object[1];
    args1[0] = nCells;
    range1.GetType().InvokeMember("Value", BindingFlags.SetProperty, null, range1, args1);
    例程: 
    using System;
    using System.Reflection; 
    using System.Runtime.InteropServices; 
    using Excel;class Excel {
    public static int Main() {
    Application exc = new Application();
    if (exc == null) {
    Console.WriteLine("ERROR: EXCEL couldn't be started!");
    return 0;
    }exc.set_Visible(0, true); 
    Workbooks workbooks = exc.Workbooks;
    _Workbook workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet, 0); 
    Sheets sheets = workbook.Worksheets;_Worksheet worksheet = (_Worksheet) sheets.get_Item(1);
    if (worksheet == null) {
    Console.WriteLine ("ERROR: worksheet == null");
    }Range range1 = worksheet.get_Range("C1", Missing.Value);
    if (range1 == null) {
    Console.WriteLine ("ERROR: range == null");
    }
    const int nCells = 1;
    Object[] args1 = new Object[1];
    args1[0] = nCells;
    range1.GetType().InvokeMember("Value", BindingFlags.SetProperty, null,range1, args1);
    return 100;
    }
    }现在我们来看看如何使用数组,他有些类似于设置单元格。仅仅需要的改变只是args2[0] = array2; 
    const int nCell = 5;
    Range range2 = worksheet.get_Range("A1", "E1");
    int[] array2 = new int [nCell];
    for (int i=0; i < array2.GetLength(0); i++) {
    array2[i] = i+1;
    }
    Object[] args2 = new Object[1];
    args2[0] = array2;
    range2.GetType().InvokeMember("Value", BindingFlags.SetProperty, null, range2, args2);
     
          
       
     
      

  3.   

    利用ASP.NET来访问Excel文档 http://www.dcren.net/xxtd/aspnet52.htmC#如何在Form中嵌入并且操作Excel表格
    http://www.csdn.net/Develop/Article/18/18344.shtm
      

  4.   

    to:jlhdlj() 
      这个例子我见过。
      但是在这里:
          Dim myOleDbCommand As OleDbCommand = New OleDbCommand("SELECT * 
       FROM [Sheet1$]",myOleDbConnection)
      如果人家的Sheet名改了呢?如何能知道它改过的Sheet名称?
      

  5.   

    http://www.c-sharpcorner.com/winforms/excelreadmg.asp
    通过上面这种方法是可以的,但必须是已知Sheet Name.要求是不知Sheet Name的情况下的读取。
      

  6.   

    string  strConn  =  "Provider=Microsoft.Jet.OLEDB.4.0;"  
           +"Data  Source="  +  this.txtFileName.Text  +  ";"  
           +"Extended  Properties=\"Excel  8.0\";"; 
    这个Connection String 对吗?我的connection的open出错啊。
      

  7.   

    错误提示:"Could not find installable ISAM."
      

  8.   

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrgrfexcelworkbookobject.asp
      

  9.   

    To:net_lover(孟子E章)
      的确,这里的信息比较全。谢谢