private void btn_Print_Click_1(object sender, EventArgs e) { RPT.RPT_PRODUCT_ALL myreport = new RPT.RPT_PRODUCT_ALL(); RPT.FRM_PRT_PRODUCT frm = new RPT.FRM_PRT_PRODUCT(); frm.crystalReportViewer1.ReportSource = myreport; frm.ShowDialog(); }
private void btn_Sava_Excel_Click_1(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; RPT.RPT_PRODUCT_ALL myreport = new RPT.RPT_PRODUCT_ALL(); //create export options ExportOptions expoert = new ExportOptions(); //create object for destination DiskFileDestinationOptions dfoptions = new DiskFileDestinationOptions(); ExcelFormatOptions exelformat = new ExcelFormatOptions(); //set the path of destionation SaveFileDialog ofd = new SaveFileDialog(); ofd.Filter = "ملفات exel | *.xls"; if (ofd.ShowDialog() == DialogResult.OK) { dfoptions.DiskFileName = ofd.FileName; } expoert = myreport.ExportOptions; expoert.ExportDestinationType = ExportDestinationType.DiskFile; expoert.ExportFormatType = ExportFormatType.Excel; expoert.ExportFormatOptions = exelformat; expoert.ExportDestinationOptions = dfoptions; myreport.Export(); this.Cursor = Cursors.Default; MessageBox.Show("تم حفظ الملف بنجاح", "الحفظ", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { return; } }