Syncfusion.XlsIO.Base
Example 


UsedRange Property

Gets a Range object that represents the used range on the specified worksheet. Read-only.
Syntax
'Declaration
 
ReadOnly Property UsedRange As IRange
'Usage
 
Dim instance As IWorksheet
Dim value As IRange
 
value = instance.UsedRange
IRange UsedRange {get;}
Example
The following code illustrates how to get used range on the specified worksheet.
using Syncfusion.XlsIO;
using System;       
            
class Program
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create worksheet
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(2);
            IWorksheet worksheet = workbook.Worksheets[0];
            
            //Set text
            worksheet["B2"].Text = "Text";
            worksheet["J5"].Text = "Text";
            
            //Set Color
            worksheet["J3"].CellStyle.ColorIndex = ExcelKnownColors.Red;
            
            //Get used range
            Console.Write(worksheet.UsedRange.AddressLocal);
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
            Console.ReadKey();
        }
    }
}
//Output will be
//B2:J5
AssemblyVersion

Syncfusion.XlsIO.Base: 16.3460.0.29

See Also