static void Main(string[] args) { Export obj = new ExportToPdf(); // Export to pdf can be substituted obj.Convert(@"c:\demo.txt"); Export obj1 = new ExportToExcel(); // Export to Excel can be substituted obj1.Convert(@"c:\demo.txt"); }
static void Main(string[] args) { Export obj; if (1 == 1) //PDF { obj = new ExportToPdf(); // Export to pdf can be substituted } else { obj = new ExportToExcel(); } obj.Convert(@"c:\demo.txt"); }
/// <summary> /// Handles the Click event of the BtnExportPdf control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void BtnExportPdf_Click(object sender, System.Windows.RoutedEventArgs e) { var patientFileName = "Haenggi Results - " + patientInformation.PatientName + ".pdf"; var saveDialog = new Microsoft.Win32.SaveFileDialog() { Filter = "PDF Files|*.pdf", FilterIndex = 0, RestoreDirectory = true, FileName = patientFileName, }; var fileName = string.Empty; if (saveDialog.ShowDialog().GetValueOrDefault()) { fileName = saveDialog.FileName; ExportToPdf.Export(result, patientInformation, fileName); } }
private void Button_PrintGenerateTransaction_Click(object sender, EventArgs e) { ExportToPdf exportPdf = new ExportToPdf(); exportPdf.ExportPDFDocument(Grid_GenerateTransaction); }
private void Button_PrintDonors_Click(object sender, EventArgs e) { ExportToPdf pdf = new ExportToPdf(); pdf.ExportPDFDocument(Grid_ViewDonors); }