private void button7_Click(object sender, EventArgs e) { RPT.rpt_all_product myreport = new RPT.rpt_all_product(); //creat export options ExportOptions export = new ExportOptions(); //creat object for destination DiskFileDestinationOptions dfoptions = new DiskFileDestinationOptions(); ExcelFormatOptions excelformat = new ExcelFormatOptions(); //set the path of desyination dfoptions.DiskFileName = @"D:\producrslist.xls"; export = myreport.ExportOptions; export.ExportDestinationType = ExportDestinationType.DiskFile; export.ExportFormatType = ExportFormatType.Excel; export.ExportFormatOptions = excelformat; export.ExportDestinationOptions = dfoptions; myreport.Export(); MessageBox.Show("list exported successfully !", "export", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); }
private void button6_Click(object sender, EventArgs e) { RPT.rpt_all_product MYREPORT = new RPT.rpt_all_product(); RPT.FRM_RPT frm = new RPT.FRM_RPT(); frm.crystalReportViewer1.ReportSource = MYREPORT; frm.ShowDialog(); }
private void button8_Click(object sender, EventArgs e) { RPT.rpt_all_product myReport = new RPT.rpt_all_product(); // Create Object For destination for select path Save file DiskFileDestinationOptions dfoptions = new DiskFileDestinationOptions(); // Create Export Option ExportOptions export = new ExportOptions(); ExcelFormatOptions excelFormat = new ExcelFormatOptions(); // Set The path to save SaveFileDialog sf = new SaveFileDialog(); sf.Filter = "Save File (*.xls ) |*.xls"; if (sf.ShowDialog() == DialogResult.OK) { dfoptions.DiskFileName = sf.FileName; export = myReport.ExportOptions; export.ExportDestinationType = ExportDestinationType.DiskFile; export.ExportFormatType = ExportFormatType.Excel; export.ExportFormatOptions = excelFormat; export.ExportDestinationOptions = dfoptions; myReport.Export(); MessageBox.Show("تم حفظ ملف بالنجاح", "تم", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void buttonX2_Click_1(object sender, EventArgs e) { RPT.rpt_all_product myreport = new RPT.rpt_all_product(); RPT.FRM_RPT_PRODUCT myform = new RPT.FRM_RPT_PRODUCT(); myform.crystalReportViewer1.ReportSource = myreport; myform.ShowDialog(); }
private void exportpdf_Click(object sender, EventArgs e) { RPT.rpt_all_product myreport = new RPT.rpt_all_product(); ExportOptions export = new ExportOptions(); DiskFileDestinationOptions dfoption = new DiskFileDestinationOptions(); ExcelFormatOptions excelformat = new ExcelFormatOptions(); dfoption.DiskFileName = @"E:\\" + "list" + ".xml"; export = myreport.ExportOptions; export.ExportDestinationType = ExportDestinationType.DiskFile; export.ExportFormatType = ExportFormatType.Excel; export.ExportFormatOptions = excelformat; export.ExportDestinationOptions = dfoption; MessageBox.Show("تمت عمليه التصدير بنجاح ", "عمليه التصدير", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void buttonX2_Click_2(object sender, EventArgs e) { try { RPT.rpt_all_product myreport = new RPT.rpt_all_product(); ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); ExcelFormatOptions CrFormatTypeOptions = new ExcelFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = "D:\\تقرير المنتجات.xls"; CrExportOptions = myreport.ExportOptions; CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.Excel; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; myreport.Export(); MessageBox.Show("تم تصدير الملف بنجاح ", "تصدير الملف", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }