ReportDocument report = new ReportDocument(); report.Load("report.rpt"); HttpResponse response = HttpContext.Current.Response; response.Buffer = false; response.ClearContent(); response.ClearHeaders(); response.ContentType = "application/pdf"; response.AddHeader("Content-Disposition", "attachment; filename=myReport.pdf"); report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, response, false, "myReport");
ReportDocument report = new ReportDocument(); report.Load("report.rpt"); HttpResponse response = HttpContext.Current.Response; response.Buffer = false; response.ClearContent(); response.ClearHeaders(); response.ContentType = "application/msword"; response.AddHeader("Content-Disposition", "attachment; filename=myReport.doc"); report.ExportToHttpResponse(ExportFormatType.WordForWindows, response, false, "myReport");In this example, we export the report to a Word document by setting the ExportFormatType to WordForWindows. Otherwise, the code is similar to the previous example. Package library: Crystal Reports for Visual Studio