我可以给你
他是将数据库的数据写道excel的免费工具
明天上www.ourfly.com去下载

解决方案 »

  1.   

    I want to know who have buy the excelwriter and how about its funtion and the payment term.
      

  2.   

    我给你个函数,但你要自己稍微修改一下。
    请加入com组件microsoft excel 5.0库。
    // 倒入:
    public static string WriteDataGrid2Excel(DataSet dt,ArrayList tableHead,string pathAndFileName) 
    {
    try
    {
    SpreadsheetClass xlsheet = new SpreadsheetClass();
    int i;
    for (int j=0;j<5;j++) 
    {
    xlsheet.ActiveSheet.Cells[1,j+1]=tableHead[j];
    }
    for(i=0;i<dt.Tables[0].Rows.Count;i++)

    DataRow rw = dt.Tables[0].Rows[i];
    for (int j=0;j<rw.ItemArray.Length;j++) 
    {
    string temp=rw[j].ToString();
    if(temp=="&nbsp;")
    xlsheet.ActiveSheet.Cells[i+2,j+1] = "";
    else xlsheet.ActiveSheet.Cells[i+2,j+1] =temp;        }

    xlsheet.ActiveSheet.Export(pathAndFileName+".xls",OWC.SheetExportActionEnum.ssExportActionNone);
    return "true";
    }
    catch(Exception ee)
    {
    return ee.Message.ToString();
    }
    }