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 }
  • 相关阅读:
    rh
    re模块
    粘包现象
    子类调用父类方法
    北大医院条码
    戴德金-连续性和无理数-第1页
    数学名词
    核心英语笔记,含记忆术mnemonics
    python笔记
    收集的句子
  • 原文地址:https://www.cnblogs.com/lgx5/p/13406208.html
Copyright © 2011-2022 走看看