13 Programación Web con .NET y C#
Transcript of 13 Programación Web con .NET y C#
REPORTESASP.NET
Guido Ticona [email protected]
Crystal Reports Referencias
CrystalDecisions.SharedCrystalDecisions.ReportSourceCrystalDecisions.CrystalReports.Engine
Crystal Reports (Cont.)ReportClass rpt = new ReportClass();rpt.FileName = Server.MapPath("report.rpt");rpt.Load();rpt.SetDataSource(db.PERSONAS);Stream stream = rpt.ExportToStream(
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
return File(stream, "application/pdf");
Crystal Reports (Cont.) Parametros
rpt.SetParameterValue(“p",“valor");
RPLCLocalReport reporte= new LocalReport();reporte.ReportPath = "Reports/Report1.rdlc";ReportDataSource reportDataSource =
new ReportDataSource("DataSet1", db);reporte.DataSources.Add(reportDataSource);
RDLC (Cont.)string deviceInfo =
"<DeviceInfo>" +" <OutputFormat>PDF</OutputFormat>" +" <PageWidth>8.5in</PageWidth>" +" <PageHeight>11in</PageHeight>" +" <MarginTop>0.5in</MarginTop>" +" <MarginLeft>1in</MarginLeft>" +" <MarginRight>1in</MarginRight>" +" <MarginBottom>0.5in</MarginBottom>" +"</DeviceInfo>";
RDLC (Cont.)byte[] renderedBytes = reporte.Render(
reportType,deviceInfo,out mimeType,out encoding,out fileNameExtension,out streams, //string[]out warnings); //Warning[]
return File(renderedBytes, mimeType);
RDLC (Cont.) Referencias
Microsoft.ReportViewer.WebForms Parámetros
reporte.SetParameters(new ReportParameter(“p",“valor"));
Descargar ArchivoResponse.AddHeader("content-disposition",
"attachment; filename=reporte." + fileNameExtension);