private void btnPDF_Click(object sender, EventArgs e) { RPT.rpt_all_Categories myreport = new RPT.rpt_all_Categories(); //create export options ExportOptions expoert = new ExportOptions(); //create object for destination DiskFileDestinationOptions dfoptions = new DiskFileDestinationOptions(); PdfFormatOptions pdfformat = new PdfFormatOptions(); //set the path of destionation SaveFileDialog ofd = new SaveFileDialog(); ofd.Filter = "ملفات pdf | *.pdf"; if (ofd.ShowDialog() == DialogResult.OK) { dfoptions.DiskFileName = ofd.FileName; } expoert = myreport.ExportOptions; expoert.ExportDestinationType = ExportDestinationType.DiskFile; expoert.ExportFormatType = ExportFormatType.PortableDocFormat; expoert.ExportFormatOptions = pdfformat; expoert.ExportDestinationOptions = dfoptions; myreport.Refresh(); myreport.Export(); MessageBox.Show("تم حفظ الملف بنجاح", "الحفظ", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnPrint_Click(object sender, EventArgs e) { RPT.rpt_all_Categories rpt = new RPT.rpt_all_Categories(); RPT.FRM_PRT_PRODUCT frm = new RPT.FRM_PRT_PRODUCT(); rpt.Refresh(); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); }