private void SaveControlFile() { Common.WriteToDebugWindow(String.Format("SaveControlFile:{0},{1},{2},{3:F2}", CycleDate.ToShortDateString(), CurrentDate.ToShortDateString(), RecordCount, TotalAmount)); string fileName = null; string initialDirectory = OutputPath; if (null != (fileName = GetControlFileName())) { string outputFile = ExcelHlp.GetSaveFileName(initialDirectory, fileName); FileInfo fileInfo = new FileInfo(outputFile); OutputPath = fileInfo.DirectoryName; using (StreamWriter writer = new StreamWriter(outputFile)) { // TODO:(crhodes) Remove TotalAmount for CMF output writer.Write(String.Format("{0},{1},{2},{3:F2}", CycleDate.ToShortDateString(), CurrentDate.ToShortDateString(), RecordCount, TotalAmount)); writer.Close(); } pnlTask_SaveControlFile.BackColor = Color.Green; } else { pnlTask_SaveControlFile.BackColor = Color.Red; } }
private void SaveOutputFile() { string outputFileName = GetDefaultOutputFileName(); var _with8 = Globals.ThisAddIn.Application; outputFileName = ExcelHlp.GetSaveFileName(Common.cDEFAULT_FOLDER, outputFileName, "Enter Save As Name"); if (outputFileName.Length > 0) { _with8.ActiveWorkbook.SaveAs(Filename: outputFileName, FileFormat: XlFileFormat.xlOpenXMLWorkbook, CreateBackup: false); } }
private void SaveDetailFile() { Common.WriteToDebugWindow(String.Format(@"SaveDetailFile: {0} - {1}\{2}", FileType, Path, RelativePath)); string fileName = null; string initialDirectory = String.Format(@"{0}\{1}", Path, RelativePath); Workbook wb = Globals.ThisAddIn.Application.ActiveWorkbook; if (null != (fileName = GetOutputFileName())) { string outputFile = ExcelHlp.GetSaveFileName(initialDirectory, fileName); FileInfo fileInfo = new FileInfo(outputFile); OutputPath = fileInfo.DirectoryName; wb.SaveAs(Filename: outputFile, FileFormat: XlFileFormat.xlCSV); pnlTask_SaveDetailFile.BackColor = Color.Green; } else { pnlTask_SaveDetailFile.BackColor = Color.Red; } }