Access Manually created cell range in .NET

How to access a manually created cell range in an existing Excel file? For e.g. See attached excel. It has a cell range named LoginDetails (B1 to C4).

-Jayesh

Hi,

Thanks for your posting and using Aspose.Cells.

Please use the Workbook.Worksheets.Names property to retrieve all the named ranges in your workbook having workbook or sheet scope.

Please see the following sample code and its output.

C#

string filePath = @“F:\Shak-Data-RW\Downloads\test.xls”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.Worksheets[0];


foreach (Name range in workbook.Worksheets.Names)

{

Debug.WriteLine("------------------------------------");

Debug.WriteLine(“Refer To: " + range.RefersTo);

Debug.WriteLine(“Text: " + range.Text);

Debug.WriteLine(”------------------------------------”);

}

Output:
------------------------------------
Refer To: =Sheet1!$B$1:$C$4
Text: LoginDetails
------------------------------------