public static ExcelRange WriteValuesHorizontally(this ExcelRange range, List <string> values) { var data = new object[1, values.Count]; var extendedRange = range.ExtendRangeSize(0, values.Count - 1); values.ForEach(v => data[0, values.IndexOf(v)] = v); return(extendedRange.SetValue(data)); }
public static ExcelRange WriteValuesVertically(this ExcelRange range, List <string> values) { var data = new object[values.Count, 1]; var extendedRange = range.ExtendRangeSize(values.Count - 1, 0); values.ForEach(v => data[values.IndexOf(v), 0] = v); return(extendedRange.SetValue(data)); }
public static ExcelRange GetRangeForSize(this ExcelRange range, int numberOrRows, int numberOfColumns) { Range topLeft = range.GetLeftTopCell().GetInteropVersion(); return(range.ExtendRangeSize(numberOrRows - 1, numberOfColumns - 1)); }