Add API to get the list of ranges to which a defined name refers.
Example:
List<CellRange> ranges = workbook.Names["definedName"].Ranges;
CellSelection selection = worksheet.Cells[ranges];
The cell range referred by the defined name could be accessed using code similar to the following one:
foreach (var name in workbook.Names)
{
if (name.Name == givenName)
{
string[] v = name.RefersTo.Split("!".ToCharArray());
foreach (Worksheet sheet in workbook.Sheets)
{
if (sheet.Name.ToUpper() == v[0].Replace("=", String.Empty).ToUpper())
{
string rangeName = v[1];
string firstIndexName = rangeName.Split(":".ToCharArray())[0];
int rowIndex;
int columnIndex;
bool isRowAbsolute;
bool isColumnAbsolute;
bool nameRefersToIndex = NameConverter.TryConvertCellNameToIndex(firstIndexName, out isRowAbsolute, out rowIndex, out isColumnAbsolute, out columnIndex);
if (nameRefersToIndex)
{
sheet.Cells[rowIndex, columnIndex].SetValue(givenValue);
}
}
}
}
}