protected void lbtnSelec_Command(object sender, CommandEventArgs e) { string[] commandArgsAccept = e.CommandArgument.ToString().Split(new char[] { ',' }); int ra = Convert.ToInt32(commandArgsAccept[0]); string nome = commandArgsAccept[1].ToString(); HorarioAlunoCr cr = new HorarioAlunoCr(); HorarioAlunoDs ds = new HorarioAlunoDs(); OfertaCursoModulo ocm = new OfertaCursoModulo(); DataTable dt = ocm.RecuperarHrAluno(ra, Convert.ToInt32(hfCodOc.Value)); ds.dtHorario.Merge(dt); cr.SetDataSource(ds); cr.SetParameterValue("pNome", nome); cr.SetParameterValue("pRa", ra); 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() { HorarioAlunoCr rpt = new HorarioAlunoCr(); rpt.Site = this.Site; return(rpt); }