Combine Excel Ranges
IronXL allows us to combine more than one `IronXL.Ranges.Range` using the '+' operator.
using System.Linq; using IronXL; WorkBook workbook = WorkBook.Load("test.xls"); WorkSheet sheet = workbook.WorkSheets.First(); //This is how we get a range from an Excel worksheet var range = sheet["A2:A8"]; var combinedRange = range + sheet["A9:A10"];; //Iterate over combined range foreach (var cell in combinedRange) { Console.WriteLine(cell.Value); }
Imports System.Linq Imports IronXL Private workbook As WorkBook = WorkBook.Load("test.xls") Private sheet As WorkSheet = workbook.WorkSheets.First() 'This is how we get a range from an Excel worksheet Private range = sheet("A2:A8") Private combinedRange = range + sheet("A9:A10") 'Iterate over combined range For Each cell In combinedRange Console.WriteLine(cell.Value) Next cell
IronXL allows us to combine more than one `IronXL.Ranges.Range` using the '+' operator.