private void PrintSalesSummary_Load(object sender, EventArgs e) { var saleSum = new SalesSummary(); saleSum.SetDataSource(_summaryReport); crystalReportViewer1.ReportSource = saleSum; crystalReportViewer1.Zoom(50); }
private string ConvertReportToPDF() { var summaryReport = CreateSummarySalesReport(); InsertSummaryData(summaryReport); summaryReport.WriteXml("summaryReport.xml"); var saleSum = new SalesSummary(); saleSum.SetDataSource(summaryReport); try { ExportOptions crOptions; DiskFileDestinationOptions crDestinationOptions=new DiskFileDestinationOptions(); PdfRtfWordFormatOptions pdfRtf=new PdfRtfWordFormatOptions(); crDestinationOptions.DiskFileName = @"saleSummary.pdf"; crOptions = saleSum.ExportOptions; { crOptions.ExportDestinationType = ExportDestinationType.DiskFile; crOptions.ExportFormatType = ExportFormatType.PortableDocFormat; crOptions.DestinationOptions = crDestinationOptions; crOptions.FormatOptions = pdfRtf; } saleSum.Export(); return @"saleSummary.pdf"; } catch (Exception e) { //ignore } return null; }