public static List <string> ReadMyExcel(Excel.Worksheet MySheet, ExcelPoint postion) { List <string> result = new List <string>(); foreach (var range in postion.ListCells) { string MyValue = (string)MySheet.get_Range(range).Cells.Value; result.Add(MyValue); } return(result); }
public static List <object> ReadExcelValues(ExcelPoint postion) { MySheet = (Excel.Worksheet)MyBook.Sheets[postion.SheetName]; List <object> result = new List <object>(); foreach (var range in postion.ListCells) { var MyValue = MySheet.get_Range(range).Cells.Value; result.Add(MyValue); } return(result); }
public static List <object> ReadMyExcel(Excel.Worksheet MySheet, ExcelPoint postion) { string CellName = ""; List <object> result = new List <object>(); try { foreach (var range in postion.ListCells) { CellName = range; var MyValue = MySheet.get_Range(range).Cells.Value; result.Add(MyValue); } } catch { throw new Exception("Invalid format in Sheet: " + MySheet.Name + " , at Cell: " + CellName); } return(result); }