private void btnImprimerSingle_Click(object sender, EventArgs e) { RPT.RPT_SINGLE_CATEGORIE myReport = new RPT.RPT_SINGLE_CATEGORIE(); RPT.RPT_PRODUCT frm = new RPT.RPT_PRODUCT(); myReport.SetParameterValue("@ID", dgvCategorie.CurrentRow.Cells[0].Value.ToString()); frm.crystalReportViewer1.ReportSource = myReport; frm.ShowDialog(); }
private void btnSaveCatPro_Click(object sender, EventArgs e) { saveFileDialog1.Title = "Save to:"; saveFileDialog1.FileName = "Categories Details.pdf"; saveFileDialog1.Filter = "PDF file |*.pdf"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string Path = saveFileDialog1.FileName; RPT.RPT_SINGLE_CATEGORIE myReport = new RPT.RPT_SINGLE_CATEGORIE(); // Create Export Option ExportOptions export = new ExportOptions(); // Create Obect For Destination DiskFileDestinationOptions dfoption = new DiskFileDestinationOptions(); PdfFormatOptions pdfformat = new PdfFormatOptions(); // Set The Path Of Destination dfoption.DiskFileName = Path; export = myReport.ExportOptions; export.ExportDestinationType = ExportDestinationType.DiskFile; export.ExportFormatType = ExportFormatType.PortableDocFormat; export.ExportFormatOptions = pdfformat; export.ExportDestinationOptions = dfoption; myReport.SetParameterValue("@ID", Convert.ToInt32(txtID.Text)); myReport.Export(); MessageBox.Show("Liste Exportée avec Succès", "Export", MessageBoxButtons.OK, MessageBoxIcon.Information); } }