我用的是excell2003,对用excelapplication的cells属性返回的数据调用tostring()方法返回的是comobj

解决方案 »

  1.   

    string StrConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + FilePath + ";" + "Extended Properties=Excel 8.0;";
    OleDbConnection MyConn = new OleDbConnection(StrConn);
    // MyConn.Open();
    string StrExcel = "";
    OleDbDataAdapter MyCommand = null;
    DataSet ds = null;
    StrExcel = "select * from [特定页$]";
    MyCommand = new OleDbDataAdapter(StrExcel, StrConn);
    ds = new DataSet();
    MyCommand.Fill(ds, "table1");
    //MyConn.Close();
    return ds.Tables[0].Rows[特定行号][特定列号];
      

  2.   

    如果用这种方法无法读不规则的excel,我只要能一个单元格一个单元格读的方法