Combine Excel Ranges
IronXL allows us to combine more than one IronXL.Ranges.Range
using the '+' operator.
using IronXL; using System; using System.Linq; WorkBook workBook = WorkBook.Load("sample.xls"); WorkSheet workSheet = workBook.WorkSheets.First(); // Get a range from an Excel worksheet var range = workSheet["A2:A8"]; // Combine two ranges var combinedRange = range + workSheet["A9:A10"]; // Iterate over combined range foreach (var cell in combinedRange) { Console.WriteLine(cell.Value); }
Imports IronXL Imports System Imports System.Linq Private workBook As WorkBook = WorkBook.Load("sample.xls") Private workSheet As WorkSheet = workBook.WorkSheets.First() ' Get a range from an Excel worksheet Private range = workSheet("A2:A8") ' Combine two ranges Private combinedRange = range + workSheet("A9:A10") ' Iterate over combined range For Each cell In combinedRange Console.WriteLine(cell.Value) Next cell
Install-Package IronXL.Excel
IronXL allows us to combine more than one IronXL.Ranges.Range
using the '+' operator.
9 .NET API products for your office documents