文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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();

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载