コード例 #1
0
        private void buttonPDFcurrent_Click(object sender, EventArgs e)
        {
            string filedes = @"D:\stock proj\CategoryDetails.pdf";

            if (File.Exists(filedes))
            {
                File.Delete(filedes);
            }
            Reports.Single_Cat_Report report = new Reports.Single_Cat_Report();
            report.Refresh();
            //export options obj
            report.SetParameterValue("@id", int.Parse(textid.Text));
            ExportOptions ex = new ExportOptions();
            //create disk obj
            DiskFileDestinationOptions disk      = new DiskFileDestinationOptions();
            PdfFormatOptions           pdfformat = new PdfFormatOptions();

            //set the path
            disk.DiskFileName = @"D:\stock proj\CategoryDetails.pdf";
            ex = report.ExportOptions;
            ex.ExportDestinationType    = ExportDestinationType.DiskFile;
            ex.ExportFormatType         = ExportFormatType.PortableDocFormat;
            ex.ExportFormatOptions      = pdfformat;
            ex.ExportDestinationOptions = disk;
            report.Export();
            MessageBox.Show("Successfuly Stored", "Stored Report", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #2
0
 private void buttonPcurrent_Click(object sender, EventArgs e)
 {
     Reports.Single_Cat_Report rep  = new Reports.Single_Cat_Report();
     Reports.Product_Report    form = new Reports.Product_Report();
     rep.Refresh();
     rep.SetParameterValue("@id", int.Parse(textid.Text));
     form.crystalReportViewer1.ReportSource = rep;
     form.ShowDialog();
 }