コード例 #1
0
        public ActionResult ExportActa(int?id)
        {
            ReportDocument rd = new ReportDocument();

            var rs = db.getReporteXSesion(id).ToList();

            rd.Load(Path.Combine(Server.MapPath("~/CrystalReports"), "SesionReporte.rpt"));

            rd.SetDataSource(rs);
            rd.SetParameterValue("idSesion", id);
            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();


            Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            stream.Seek(0, SeekOrigin.Begin);

            return(File(stream, "application/pdf", "Acta" + id.ToString() + ".pdf"));
        }