如题~

解决方案 »

  1.   

    Interop.Excel.dll
    Interop.Microsoft.Office.Core.dll
      

  2.   

    你可以把数据导入到CSV文件中,这样比较简单。DataSet ds = (DataSet)Session["ds"];//最好不要使用Session存储DataSet
    DataTable dt=ds.Tables[0];     
    StringWriter sw=new StringWriter();  
    sw.WriteLine("货品单号,货品名称,货品数量,货品价格,提供商,货品仓库,付款方式,够入部门,够入时间,操作人,状态");     
    foreach(DataRow dr in dt.Rows)     
    {     
    sw.WriteLine(dr["danhao"]+","+dr["capname"]+","+dr["total"]+","+dr["price"]+","+dr["offername"]+","+dr["Wname"]+","+dr["paytype"]+","+dr["deptname"]+","+dr["indate"]+","+dr["operator"]+","+dr["Fname"]);
    }     
    sw.Close();     
    Response.AddHeader("Content-Disposition","attachment;filename=gdzc.csv");     
    Response.ContentType="application/ms-excel";     
    Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");     
    Response.Write(sw); 
    Response.End(); 
      

  3.   

    导入的名称控件:
    System.IO;
      

  4.   

    楼上是把数据导入到
    Excle里面吗??
    学习一下
      

  5.   

    确保C:\TEMP目录有写权限的情况下:EXEC master..xp_cmdshell 'bcp "select * from [DataBaseName].[dbo].[TableName]" queryout C:\TEMP\A.xls -c -T'
      

  6.   

    Interop.Excel.dll 
    打开excel模板,赋值给单元格,导出eccel就可打印
    http://www.cnblogs.com/zpylh/articles/1281048.html
    http://www.cnblogs.com/KissKnife/archive/2007/02/28/660147.html