private void BTM_SAVE_SINGLE_Click(object sender, EventArgs e) { RPT.RPT_SINGLE_CATEGORY My_Report = new RPT.RPT_SINGLE_CATEGORY(); ExportOptions export = new ExportOptions(); DiskFileDestinationOptions dfoption = new DiskFileDestinationOptions(); //PdfFormatOptions pdfformat = new PdfFormatOptions(); PdfFormatOptions pdfFormatt = new PdfFormatOptions(); //set destination of file to save in dfoption.DiskFileName = @"D:\category_details.pdf"; export = My_Report.ExportOptions; export.ExportDestinationType = ExportDestinationType.DiskFile; //export.ExportFormatType = ExportFormatType.PortableDocFormat; export.ExportFormatType = ExportFormatType.PortableDocFormat; export.ExportFormatOptions = pdfFormatt; //export.ExportFormatOptions = pdfformat; export.ExportDestinationOptions = dfoption; My_Report.SetParameterValue("@ID", Convert.ToInt32(TXT_ID.Text)); //My_Report.Refresh(); My_Report.Export(); MessageBox.Show("تم الحفظ ", "حفظ", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void BTM_PRINT_SINGLE_Click(object sender, EventArgs e) { RPT.RPT_SINGLE_CATEGORY rpt = new RPT.RPT_SINGLE_CATEGORY(); RPT.FRM_RPT_PRODUCT frm = new RPT.FRM_RPT_PRODUCT(); rpt.SetParameterValue("@ID", Convert.ToInt32(TXT_ID.Text)); //rpt.Refresh(); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); }
private void PrintCurrentCateg_Click(object sender, EventArgs e) { RPT.RPT_SINGLE_CATEGORY rpt = new RPT.RPT_SINGLE_CATEGORY(); RPT.FRM_RPT_PRODUCT frm = new RPT.FRM_RPT_PRODUCT(); rpt.SetParameterValue("@id", Convert.ToInt32(textID.Text)); //this to insert id from combox frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); btnAdd.Enabled = false; btnNew.Enabled = true; btnEdit.Enabled = false; btnDelete.Enabled = false; PrintCurrentCateg.Enabled = false; ExportToExcelCurrent.Enabled = false; }
private void ExportToExcelCurrent_Click(object sender, EventArgs e) { RPT.RPT_SINGLE_CATEGORY myreport = new RPT.RPT_SINGLE_CATEGORY(); //Create Export Options خاص باعدادات التقرير ExportOptions export = new ExportOptions(); //Create object for Destination خاص بمكان حفظ التقرير DiskFileDestinationOptions dfdoptions = new DiskFileDestinationOptions(); PdfFormatOptions pdfformat = new PdfFormatOptions(); //set the path of destination رابط المسار الذى نريد وضع الملف فيه dfdoptions.DiskFileName = "E:\\CategoryDetails.pdf"; export = myreport.ExportOptions; export.ExportDestinationType = ExportDestinationType.DiskFile; export.ExportFormatType = ExportFormatType.PortableDocFormat; export.ExportFormatOptions = pdfformat; export.ExportDestinationOptions = dfdoptions; myreport.SetParameterValue("@id", Convert.ToInt32(textID.Text)); //To create or inseart id ... myreport.Export(); MessageBox.Show("List Exported Successfuly ! ", "Export", MessageBoxButtons.OK, MessageBoxIcon.Information); btnAdd.Enabled = false; btnNew.Enabled = true; btnEdit.Enabled = false; btnDelete.Enabled = false; PrintCurrentCateg.Enabled = false; ExportToExcelCurrent.Enabled = false; }