protected void lbtnImprimir_Click(object sender, EventArgs e) { Parcelas p = new Parcelas(); Relatorios.ReciboCr cr = new Relatorios.ReciboCr(); Relatorios.ReciboDs ds = new Relatorios.ReciboDs(); data = Convert.ToDateTime(ViewState["data"]); DataTable dt = p.RecuperarParcelasPaga(Convert.ToInt32(Request.QueryString["id"]), data); ds.dtRecibo.Merge(dt); cr.SetDataSource(ds); cr.SetParameterValue("pNome", Request.QueryString["alu"]); Stream relStream = cr.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); BinaryReader stream = new BinaryReader(relStream); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=relatorio.pdf"); HttpContext.Current.Response.ContentType = "application/pdf"; HttpContext.Current.Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length))); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.Close(); }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { ReciboCr rpt = new ReciboCr(); rpt.Site = this.Site; return(rpt); }