コード例 #1
0
 private void btnSelectPrint_Click(object sender, EventArgs e)
 {
     RPT.RPT_SINGLE_CATEGORE rpt = new RPT.RPT_SINGLE_CATEGORE();
     RPT.FRM_PRT_PRODUCT     frm = new RPT.FRM_PRT_PRODUCT();
     rpt.SetParameterValue("@ID", Convert.ToInt32(txtID.Text));
     frm.crystalReportViewer1.ReportSource = rpt;
     frm.ShowDialog();
 }
コード例 #2
0
        private void btnSelectPdf_Click(object sender, EventArgs e)
        {
            RPT.RPT_SINGLE_CATEGORE myreport = new RPT.RPT_SINGLE_CATEGORE();

            //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;

            // set parameters
            myreport.SetParameterValue("@ID", Convert.ToInt32(txtID.Text));

            // make refresh
            // myreport.Refresh();

            myreport.Export();
            MessageBox.Show("تم حفظ الملف بنجاح", "الحفظ", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }