Skip to main content

Posts

Showing posts with the label Create pdf from crystal report

Code help with example of crystal Reports

Export Crystal Report to Excel Sheet MemoryStream oStream; // using System.IO oStream = (MemoryStream) rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel); Response.Clear(); Response.Buffer = true; Response.ContentType = "appliaction/ms-excel"; Response.BinaryWrite(oStream.ToArray()); Response.End() Export Crystal Report to Excel ReportDocument rpt=new ReportDocument();//set a ReportPath and assign the dataset to reportdocument objectrpt.Load(Server.MapPath("Report1.rpt")); rpt.SetDataSource(ds); //assign the values to crystal report viewerCrystalReportViewer1.ReportSource = rpt; CrystalReportViewer1.DataBind(); //Exporting PDFMemoryStream oStream; // using System.IOoStream = (MemoryStream)rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); Response.Clear(); Response.Buffer = true;Response.ContentType = "application/pdf"; Response.BinaryWrite(oStream.To