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);
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        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());
            }
        }