private void exportBtn_Click(object sender, EventArgs e) { Result = rightListBox.Items.Cast <Element>(); this.ExportOptions = MakeExportOptions(); this.DialogResult = WF.DialogResult.OK; this.Close(); }
/// <summary> /// Export View Schedule to CSV, TSV etc. /// </summary> /// <param name="path">A valid file path with file extension.</param> /// <param name="exportOptions">Export Options. If null, default will be used.</param> /// <returns name="scheduleView">Schedule View.</returns> public ScheduleView Export( string path, ScheduleExportOptions exportOptions) { if (string.IsNullOrEmpty(path)) { throw new ArgumentException(Properties.Resources.View_ExportAsImage_Path_Invalid, "path"); } if (exportOptions == null) { throw new ArgumentException(Properties.Resources.ExportOptionsArgumentException); } // Run export string folder = System.IO.Path.GetDirectoryName(path); string name = System.IO.Path.GetFileName(path); try { this.InternalViewSchedule.Export(folder, name, exportOptions.InternalScheduleExportOptions); } catch (Exception ex) { throw new Exception(Properties.Resources.ScheduleExportError, ex); } return(this); }
private ScheduleExportOptions MakeExportOptions() { SplitFileOptions splitFile; SplitDataOptions splitData; if (multipleFilesRB.Checked) { splitFile = SplitFileOptions.MultipleFiles; } else if (oneFileMultipleSheetRB.Checked) { splitFile = SplitFileOptions.OneFileMultiSheet; } else { splitFile = SplitFileOptions.OneFileOneSheet; } if (splitMultiSheetRB.Checked) { splitData = SplitDataOptions.MultipleSheet; } else if (splitOneSheetRB.Checked) { splitData = SplitDataOptions.OneSheet; } else { splitData = SplitDataOptions.NoSplit; } bool merge = mergeCheckBox.Checked; bool headers = headerCheckBox.Checked; var opt = new ScheduleExportOptions(splitFile, splitData, merge, headers); return(opt); }