• RDLC


     1 //自动导出excel/pdf/word
     2 private void ResponseFile(int oType, string fileName)
     3 {
     4     string outType;
     5     if (oType == 0)
     6     {
     7         outType = "Excel";
     8     }
     9     else if (oType == 1)
    10     {
    11         outType = "Word";
    12     }
    13     else
    14     {
    15         outType = "Word";
    16     }
    17     try
    18     {
    19         Warning[] warnings;
    20         string[] streamids;
    21 
    22         string mimeType;
    23         string encoding;
    24         string extension;
    25 
    26         byte[] bytes = ReportViewer1.LocalReport.Render(
    27                 outType, null, out mimeType, out encoding, out extension,
    28                 out streamids, out warnings);
    29         Response.Clear();
    30         Response.Buffer = true;
    31         Response.ContentType = mimeType;
    32         Response.AddHeader("content-disposition", "attachment;filename=" + fileName + "." + extension);
    33         Response.BinaryWrite(bytes);
    34 
    35         Response.Flush(); 
    36     } 
    37     catch (Exception ex)
    38     {
    39         throw new Exception(ex.Message);
    40     }
    41 }
  • 相关阅读:
    制作dos启动u盘
    服务器之ECC报错检查
    shc 对 Linux shell 脚本加密.
    Linux
    windows查看端口占用
    python语言
    AppScan9.0安装破解
    局域网灰色设置解除
    shell脚本
    nginx安装
  • 原文地址:https://www.cnblogs.com/lgx5/p/13406208.html
Copyright © 2020-2023  润新知