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

Free Support Forum - aspose.com

Getting workbook scoped named range

Hi,


Now I’m having trouble getting a workbook scoped named range.
Here is my code:

foreach (Worksheet sheet in book.Worksheets)
{
foreach (Range range in sheet.Cells.Ranges)
{
System.Console.WriteLine(range.Name);
}
}

I also attach an example file.

Please tell me if I’m doing something wrong.

Thanks,
Michael

Hi Michael,

Please modify your code a little bit like follows.

Code snippet:
Workbook objWorkbook = new Workbook(sFilePath);
Range[] objRngs = objWorkbook.Worksheets.GetNamedRanges();
foreach (Range objRng in objRngs)
{
MessageBox.Show(objRng.Name);
}

Thanks,