/// <summary> /// Get a list of cell values covered by the range in the index, e.g. sheetReader["A1","B2"] will return a list of four /// values, /// going left-to-right and then top-to-bottom, from the cells A1, B1, A2, B2. /// </summary> /// <example> /// <code> /// var range = sheetReader["A1","B2"]; /// </code> /// </example> /// <param name="topLeft">The top left cell of the required range</param> /// <param name="bottomRight">The bottom right cell of the required range</param> public IEnumerable <object> this[string topLeft, string bottomRight] { get { var range = CellRef.Range(topLeft, bottomRight).Select(x => x.ToString()); var result = range.Select(x => this[x]); return(result); } }
public void RangeWorks() { var range = CellRef.Range("A1", "B2").ToArray(); range[0].ToString().Should().Be("A1"); range[1].ToString().Should().Be("B1"); range[2].ToString().Should().Be("A2"); range[3].ToString().Should().Be("B2"); }
public void SingleColumnRangeWorks() { var range = CellRef.Range("A1", "A4").ToArray(); range[0].ToString().Should().Be("A1"); range[1].ToString().Should().Be("A2"); range[2].ToString().Should().Be("A3"); range[3].ToString().Should().Be("A4"); }
public void RangeWorks() { var range = CellRef.Range("AA1", "AC3").ToArray(); range[0].ToString().Should().Be("AA1"); range[1].ToString().Should().Be("AB1"); range[2].ToString().Should().Be("AC1"); range[3].ToString().Should().Be("AA2"); range[4].ToString().Should().Be("AB2"); range[5].ToString().Should().Be("AC2"); range[6].ToString().Should().Be("AA3"); range[7].ToString().Should().Be("AB3"); range[8].ToString().Should().Be("AC3"); }