private void openExcelFile() { if (File.Exists(headersFile)) { application = new excel.Application(); application.DisplayAlerts = false; workBooks = application.Workbooks; workBook = workBooks.Open(headersFile, Type.Missing, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); sheets = workBook.Sheets; } else { em.showErrorFileNotExist(headersFile); System.Environment.Exit(0); } }
//It defines whether the application will run locally or remotely public bool defineconfigPath(bool useSP) { if (useSP) { configPath = currentDir + "\\" + configFileNameSP; return(utilities.copyFileFromSharePoint(sharePointURL, configPath)); } else { configPath = currentDir + "\\" + configFileName; // We expect to find the TMConfig locally if (!File.Exists(configPath)) { em.showErrorFileNotExist(configPath); return(false); } return(true); } }
private void openExcelTemplate() { createExcelResult(); if (File.Exists(excelResult)) { application = new excel.Application(); application.DisplayAlerts = false; workBooks = application.Workbooks; workBook = workBooks.Open(excelResult, Type.Missing, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); sheets = workBook.Sheets; sheet = sheets.get_Item(1); excelUtils.setSheet(sheet); } else { em.showErrorFileNotExist(excelResult); System.Environment.Exit(0); } }