private void ReadWorksheet() { List<ExcelEntry> retDict = new List<ExcelEntry>(); ExcelClientNetOffice ec = new ExcelClientNetOffice(); List<string> varNames = ec.GetColumnOfValues(1, 1, WorkBookFileName, WorksheetName); List<string> varValues = ec.GetColumnOfValues(1, 2, WorkBookFileName, WorksheetName); if (varNames.Count == varValues.Count) { for (int i = 0; i < varNames.Count; i++) { retDict.Add(new ExcelEntry() { ValueName = varNames[i], ValueMagnitude = varValues[i] }); } } else { throw new Exception("Number of entries in the 1st column of Excel has to be the same as in second column."); } excelDataRead = true; lookupValues = retDict; }
public void WriteFile() { //ExcelClientNetOffice ec = new ExcelClientNetOffice(); // ec.(CellReadRow, CellReadColumn, 1, 1, ExcelInputPath, InputWorksheetName); ExcelClientNetOffice ec = new ExcelClientNetOffice(); string[,] Values = new string[1, 1]; Values[0,0]= CellTargetContent; ExcelOutputEntry entry = new ExcelOutputEntry(){ StartRow = CellWriteRow, StartColumn = CellWriteColumn, Values = Values, Worksheet = OutputWorksheetName }; List<ExcelOutputEntry> entries = new List<ExcelOutputEntry>(){entry}; ec.DumpMultipleValueArrays(entries,ExcelOutputPath); }
public void ReadFile() { ExcelClientNetOffice ec = new ExcelClientNetOffice(); var CellContentArr = ec.GetArrayOfValues(CellReadRow, CellReadColumn, 1, 1, ExcelInputPath, InputWorksheetName); CellContent = CellContentArr[0, 0]; }