public void WsNamedRangesOneString() { var wb = new XLWorkbook(); IXLWorksheet ws = wb.Worksheets.Add("Sheet1"); ws.NamedRanges.Add("TestRange", "Sheet1!$A$1,Sheet1!$A$3"); IXLRanges namedRanges = ws.Ranges("TestRange"); Assert.AreEqual("$A$1:$A$1", namedRanges.First().RangeAddress.ToStringFixed()); Assert.AreEqual("$A$3:$A$3", namedRanges.Last().RangeAddress.ToStringFixed()); }
public void WsNamedRanges() { var wb = new XLWorkbook(); IXLWorksheet ws = wb.Worksheets.Add("Sheet1"); ws.Cell(1, 1).SetValue("A"); ws.Cell(2, 1).SetValue("B"); ws.Cell(3, 1).SetValue("C"); IXLRange original = ws.Range("A1:A2"); original.AddToNamed("TestRange", XLScope.Worksheet); IXLRanges namedRanges = ws.Ranges("TestRange, A3"); Assert.AreEqual(original.RangeAddress.ToStringFixed(), namedRanges.First().RangeAddress.ToString()); Assert.AreEqual("$A$3:$A$3", namedRanges.Last().RangeAddress.ToStringFixed()); }