We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to get name range from a cell

Hi, I need to be able to know the name range (equivalent to Range.Name) from a cell.


Range myRange = workbook.Worksheets.GetRangeByName(“myNameRange”);
Cell myCell = myRange.GetCellOrNull(0,0); //assume it is a single cell range

//my desired behavior
Range myRange2 = myCell.getNameRange();
Debug.Assert(myRange.Name == myRange2.Name);

Does Aspose.Cells provide similar function as above mentioned?


Thanks for your questions.

There is a workaround for this. You can access all the ranges from workbook.Worksheets.GetNamedRanges() method. It will return the range objects, from range object you can find the range’s starting and ending rows and columns.

And from cell object you can find the row and column of the cell.

Thereon, you can find, if your cell falls in a given range or not.