如题
1:取出数据放在二维数组里面
2:将处理过后的数据写excel
麻烦各位大侠在这两方面给我点具体的代码研究下

解决方案 »

  1.   

    晕 没人回答啊?
    还的继续问,我就是不会啊 
    那个select * from [Sheet1$]中的*能不能改成excel的具体的字段啊?如果能那应该是第一行的那个值还是那些A,B....
      

  2.   

    sheet.Cells(rowIndex, "C") = dtOpps.Rows(i).Item("CustomerId").ToString()
                                sheet.Cells(rowIndex, "D") = dtOpps.Rows(i).Item("OpportunityName").ToString()
                                sheet.Cells(rowIndex, "E") = dtOpps.Rows(i).Item("Value").ToString()
                                sheet.Cells(rowIndex, "F") = dtOpps.Rows(i).Item("SignDate").ToString() sheet.Cells(rowIndex, "D") = "Total $"
                            sheet.Range(sheet.Cells(rowIndex, "D"), sheet.Cells(rowIndex, "D")).Font.Bold = True
                            sheet.Cells(rowIndex, "E") = totalValue
      

  3.   

    http://www.yesky.com/SoftChannel/72342380468109312/20040819/1844435.shtml
      

  4.   

    to seekg()
    代码能不能再详细点啊?
    从excel中只取部分列不能象从数据库那样取啊?
    我只是想取出部分列填充到数据集啊
      

  5.   

    我是想通过这样的语句来填充dataset,但是有些列我不想取出来,所以我希望能通过sql语句象操作数据库那样来实现,行不行啊?string strConn = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" + this.textBox1.Text + ";Extended Properties="+"\""+"Excel 8.0;HDR=NO;IMEX=1;"+"\""; 
          OleDbConnection conn = new OleDbConnection(strConn);
    DataSet ds = new DataSet();
    try
    {
    conn.Open(); //得到Excel文档的第一个sheet名
    DataTable myTable = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables,null); 
    string tableName=myTable.Rows[0][2].ToString().Trim(); 
    OleDbDataAdapter adp = new OleDbDataAdapter("SELECT * FROM [" + tableName + "]" ,conn);

    adp.Fill(ds,"Book1");
    this.dataGrid1.DataMember="Book1";
    this.dataGrid1.DataSource=ds;

    // this.textBox2.Text=ds.Tables["Book1"].Rows[0][0].ToString()+ds.Tables["Book1"].Rows[0][1].ToString();
        


    }
    catch(Exception eOleExl)
    {

    //do sth
    }