默然simple 2016-09-13 08:48 采纳率: 88.2%
浏览 771
已采纳

asp.net导出excel问题

protected void btnWTBExport_Click(object sender, EventArgs e)
{
    try
    {
        //1普通工单 下的业务工单
        string strExportFiled = string.Empty;
        string strCodeTypeName = string.Empty;
        string strEmptyText = string.Empty;
        if (hidExportType.Value == "1")
        {
            strExportFiled = hidWTExportFiled.Value;
            strEmptyText = hidWTExportFiledName.Value;
            //字段字符串集合
            string strNewItems = strExportFiled.TrimEnd(',');
            if (!string.IsNullOrEmpty(strNewItems))
            {
                //文字描述集合
                string strNewText = strEmptyText.TrimEnd(',');

                string[] strStrNewItems = strNewItems.Substring(0, strNewItems.IndexOf('|')).Split(',');
                string[] strStrNewText = strEmptyText.Substring(0, strEmptyText.Length - 1).Split(',');
                DataTable dt1 = ExportWTBusinessData(strNewItems.Substring(0, strNewItems.IndexOf('|')), strStrNewText).Tables[0];

                if (dt1 != null && dt1.Rows.Count > 0)
                {
                    //导出Excel
                    new NpoiFileOper().DataTable2Excel(dt1, "sheet1", "工单业务导出" + DateTime.Now.ToString("yyyyMMddHHmmssfff"));
                }
                else
                {
                    return;
                }
            }
        }
    }
    catch (Exception err)
    {

    }

}
    问下这个导出的是什么表里的数据啊
  • 写回答

5条回答 默认 最新

  • it肥马 2016-09-14 07:19
    关注

    这个看不出来导出的是什么内容表,可以查看下ExportWTBusinessData,这个方法和参数,这个方法就是返回内存数据表DataTable,再通过调用NPOI组件导出成文件。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services