protected void lbtnSelecionar_Command(object sender, CommandEventArgs e) { RelAlunosDevedoresCr cr = new RelAlunosDevedoresCr(); RelAlunosDevedoresDs ds = new RelAlunosDevedoresDs(); Parcelas p = new Parcelas(); DataTable dt = p.AlunosDevedores(e.CommandArgument.ToString()); ds.dtAlunosDevedores.Merge(dt); cr.SetDataSource(ds); 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() { RelAlunosDevedoresCr rpt = new RelAlunosDevedoresCr(); rpt.Site = this.Site; return(rpt); }