日期:2014-05-17  浏览次数:20462 次

NPOI 导出Excel 多文件打包下载

protected void Button1_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable("客户档案");
            ArrayList arrColumns = GetXlsColumns();
            DataTable dtMemberUser = DAL.Member_User.GetList();

            for (int i = 0; i < arrColumns.Count; i++)
            {
                dt.Columns.Add(arrColumns[i].ToString());
            }

            foreach (DataRow dr in dtMemberUser.Rows)
            {
                DataRow row = dt.NewRow();
                Model.Sell_Order modelSellOrder = DAL.Sell_Order.GetModel(Convert.ToInt32(dr["UserID"]));
                if (modelSellOrder != null)
                {
                    row["客户编码"] = "";
                    row["客户名称"] = dr["UserName"].ToString() != "" ? dr["UserName"] : dr["NickName"];
                    row["联系电话"] = dr["Tel"];
                    row["手机"] = dr["Mobile"];
                    row["旺旺ID"] = "";
                    row["收货人"] = modelSellOrder.Recipients;
                    row["客户分类"] = "";
                    row["省市"] = string.Format("{0} {1}", dr["Province"], dr["City"]);
                    row["MSN"] = "";
                    row["skype"] = "";
                    row["支付宝账号"] = "";
                    row["淘宝地址"] = "";
       &