zoukankan      html  css  js  c++  java
  • 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 }
  • 相关阅读:
    使用高精度计算斐波那契数列 c++
    纪中9日T4 2298. 异或
    洛谷 P1416 攻击火星
    线段树小结
    纪中5日T3 1566. 幸运锁(lucky.pas/c/cpp)
    Title
    Title
    Title
    Title
    Title
  • 原文地址:https://www.cnblogs.com/lgx5/p/13406208.html
Copyright © 2011-2022 走看看