private void bntExprtPDF_Click(object sender, EventArgs e)
        {
            // todo : fix the save file problem (fixed and now works properly) Emad .. Feb 2, 2018
            try
            {
                lblState.Text = "جاري الحفظ ...";
                Reports.rpt_all_products allProductsCrystalRpt = new Reports.rpt_all_products();

                // refresh the report (clear any binded params, if the report was used before and already has a binded param)
                allProductsCrystalRpt.Refresh();


                //create export report options
                ExportOptions exprtOpts = new ExportOptions();

                DiskFileDestinationOptions dfOptions  = new DiskFileDestinationOptions();
                PdfFormatOptions           pdfFrmtOps = new PdfFormatOptions();

                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Title           = "حفظ قائمة المنتجات";
                sfd.Filter          = "PDF files (*.pdf)|*.pdf|All files (*.*)|*.*";
                sfd.CheckPathExists = true;
                sfd.ShowDialog();

                //MessageBox.Show(sfd.FileName);

                // bind the result "address of file as a string" to the dfOptions object of (DiskFileDestinationOptions dfOptions = new DiskFileDestinationOptions();)
                dfOptions.DiskFileName = sfd.FileName;

                exprtOpts = allProductsCrystalRpt.ExportOptions;
                exprtOpts.ExportDestinationType    = ExportDestinationType.DiskFile;
                exprtOpts.ExportFormatType         = ExportFormatType.PortableDocFormat;
                exprtOpts.ExportFormatOptions      = pdfFrmtOps;
                exprtOpts.ExportDestinationOptions = dfOptions;

                allProductsCrystalRpt.Export();

                lblState.Text = "تم الحفظ بنجاح";
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show("ليس لديك صلاحية لحفظ الملف في هذا المسار. من فضلك اختر مسار مختلف", "خطا بالصلاحية", MessageBoxButtons.OK, MessageBoxIcon.Error);
                lblState.Text = "..";
            }
        }
        // export the report to an excel sheet
        private void btnExprtExcel_Click(object sender, EventArgs e)
        {
            // todo : fix the save file problem
            try
            {
                lblState.Text = "جاري الحفظ ...";
                Reports.rpt_all_products allProductsCrystalRpt = new Reports.rpt_all_products();

                //create export report options
                ExportOptions exprtOpts = new ExportOptions();

                DiskFileDestinationOptions dfOptions  = new DiskFileDestinationOptions();
                ExcelFormatOptions         exlFrmtOps = new ExcelFormatOptions();

                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Title           = "حفظ قائمة المنتجات";
                sfd.Filter          = "excel files (*.xls)|*.xls|All files (*.*)|*.*";
                sfd.CheckPathExists = true;
                sfd.ShowDialog();

                //MessageBox.Show(sfd.FileName);

                dfOptions.DiskFileName = sfd.FileName;
                exprtOpts = allProductsCrystalRpt.ExportOptions;
                exprtOpts.ExportDestinationType    = ExportDestinationType.DiskFile;
                exprtOpts.ExportFormatType         = ExportFormatType.Excel;
                exprtOpts.ExportFormatOptions      = exlFrmtOps;
                exprtOpts.ExportDestinationOptions = dfOptions;

                allProductsCrystalRpt.Export();

                lblState.Text = "تم الحفظ بنجاح";
            } catch (UnauthorizedAccessException)
            {
                MessageBox.Show("ليس لديك صلاحية لحفظ الملف في هذا المسار. من فضلك اختر مسار مختلف", "خطا بالصلاحية", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }