예제 #1
0
        public ActionResult ExportarLista()
        {
            ReportDocument rd = new ReportDocument();

            var rs = db.getAsistencia(1).ToList();

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

            rd.SetDataSource(rs);
            rd.SetParameterValue("idSesion", 1);
            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", "ListaSesion.pdf"));
        }