public ExportToText(MonthlyExcelFile monthlyExcelFile, ExcelFile catalogExcelFile) { this.monthlyExcelFile = monthlyExcelFile; this.catalogExcelFile = catalogExcelFile; textFile = new TextFile(TextFile.path); int lastRow = ExcelUtil.GetLastRow(monthlyExcelFile.worksheet); for (int row = 2; row <= lastRow; row++) { CreateInvoice(row); if (Invoice.GetInstance().IsNoErrors) { textFile.Write(Invoice.GetInstance().ToString()); deleteRecordsToBeDeleted(); } Invoice.GetInstance().Zeroize(); } PassOrdersLeft(); PassLinesLeft(); monthlyExcelFile.CleanUp(); catalogExcelFile.CleanUp(); if (ErrorsModel.errors.Count < 1) { Process.Start(TextFile.path); } }