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

Free Support Forum - aspose.com

Named range bug

wbook.Worksheets.GetRangeByName(“RANGE”) returns null if “RANGE” is not rectangle area. For example, try to name range that consists of cells A1 and A3. It’s very strange because non-rectangular ranges in Excel are allowed and work fine.

Hi Vladimir,

Please forward us your sample application and excel file. This will help us finding the issue.


Please, here you are.

My program uses range intersection to access data in cells, that way, correct functioning of this feature is very important for me.

Thank you.


If you are implementing/retrieving non rectangular ranges, please see the following sample code for reference:

Workbook workbook = new Workbook();
Name name = workbook.Worksheets.Names[“BUG_RANGE_2”];
Range[] ranges = name.GetRanges();
int frow, fcol;
int rowcount, colcount;

if (ranges != null)
for (int i = 0; i < ranges.Length; i++)
frow = ranges[i].FirstRow;
fcol = ranges[i].FirstColumn;
string f1 = CellsHelper.CellIndexToName(frow, fcol);
MessageBox.Show(ranges[i].FirstRow + “:” + ranges[i].FirstColumn);

rowcount = ranges[i].RowCount - 1 + ranges[i].FirstRow;
colcount = ranges[i].ColumnCount - 1 + ranges[i].FirstColumn;
string f2 = CellsHelper.CellIndexToName(rowcount, colcount);

MessageBox.Show(f1 + “:” + f2);


Thank you.

Thank you for this workaround. At this moment it’s enough for me.

But it looks very strange. I think Range class in Aspose.Cells must represent range in the terms of MS Excel, while ranges in Excel may be complex, even they may spread over several worksheets.
Subdivision of complex range into simple ranges may optional, but it annoying to use it in mandatory way.

I hope Aspose developers fix this drawbak in future.