public ActionResult GenerateReport4() { DB50Entities db = new DB50Entities(); var c = db.Report4(); CrystalReport4 r = new CrystalReport4(); r.Load(); Stream s = r.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(s, "application/pdf")); }
/// <summary> /// Download PDF of Policy and rules /// </summary> /// <returns></returns> public ActionResult ExportPolicyAndRules() { List <PolicyAndRule> allCustomer = new List <PolicyAndRule>(); allCustomer = db.PolicyAndRules.ToList(); CrystalReport4 rd = new CrystalReport4(); rd.Load(Path.Combine(Server.MapPath("~/CrystalReports"), "ReportCustomer.rpt")); rd.SetDataSource(allCustomer); 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", "PolicyAndRulelist.pdf")); }