文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Export specific format report directly (Local Report)

Export specific format report directly (Local Report)

时间:2011-02-14  来源:blair0807

 

代码             string 
orderIDCollection  = "1,2,3";
            //new a ReportViewer control
            ReportViewer rview = new Microsoft.Reporting.WebForms.ReportViewer();
            rview.ProcessingMode = ProcessingMode.Local;  
            rview.LocalReport.ReportPath = "rptOrder.rdlc";
            rview.ExportContentDisposition = ContentDisposition.AlwaysAttachment;
            //get datasource 
            List<OrderInfo> orderList = new List<OrderInfo>(GetOrderList(orderIDCollection));     
    //assign datasource for report
            rview.LocalReport.DataSources.Add(
                new Microsoft.Reporting.WebForms.ReportDataSource("OrderInfoDataSet",
                orderList));

            rview.LocalReport.Refresh();
        
            string mimeType, encoding, extension, deviceInfo;
            string[] streamids;
            Microsoft.Reporting.WebForms.Warning[] warnings;
            string format = "PDF";
            //Desired format goes here (PDF, Excel, or Image)
            deviceInfo ="<DeviceInfo>" +"<SimplePageHeaders>True</SimplePageHeaders>" +"</DeviceInfo>"; 
            byte[] bytes = rview.LocalReport.Render(format, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); 
            Response.Clear();
            Response.ContentType = "application/pdf";
                Response.AddHeader("Content-disposition", "filename=output.pdf");
           
            Response.OutputStream.Write(bytes, 0, bytes.Length);
            Response.OutputStream.Flush();
            Response.OutputStream.Close();
            Response.Flush();
            Response.Close();

 

排行榜 更多 +
云海之下手游

云海之下手游

角色扮演 下载
战玲珑2最新版本

战玲珑2最新版本

角色扮演 下载
逃跑吧少年虫虫助手正式版

逃跑吧少年虫虫助手正式版

体育竞技 下载