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

Free Support Forum - aspose.com

Aspose Range Issue

Hi Team,

I am attaching test file. In this file I have range with name “t1_lock”.
When i am trying to get data from this name then Aspose return NULL.
It did not find this range.
Range[] ranges = workbook.Worksheets.GetNamedRanges(); //test
string rTemp = string.Empty;
foreach (var rr in ranges)
rTemp = rr.Name;

//or by name

Range rangelocked = workbook.Worksheets.GetRangeByName(“t1_lock”);

Please help,
paRangeTest.zip (5.6 KB)


Thanks for using Aspose APIs.

Please use the Workbook.Worksheets.Names property for your needs. Please see the following screenshot that shows your mentioned named range for your reference.


Hi Faiz,

I got this name.
NameCollection names = workbook.Worksheets.Names; //test
string nTemp = string.Empty;
foreach (var nn in names)
nTemp = nn.Text;

But I need to get data from this Range.
And I know how to get data by Range name.
How can I get data if I know only Name?

Please help.


Please see the following code. It works fine and fit your needs. It returns the array of ranges from the named range.


Workbook wb = new Workbook("RangeTest.xlsx");

Name nm = wb.Worksheets.Names[0];

Range[] rngs = nm.GetRanges();

Thank you for your help.

Hi Faiz
How to protect worksheet with only ‘Select unlocked cells’ checked?

Worksheet wsPr = workbook.Worksheets[sheet.Name];
wsPr.Protect(ProtectionType.All, “”, “”);

Please help.


See the reply in your other thread:

When I try to save file
I want to save with this settings (see attached image)Protect Sheet.png (3.9 KB)

Please help

Thank you,


Thanks for the screenshot.

See the document for your reference, you need to use the following line of code:
Sample code:

// Allowing users to select unlocked cells of the worksheet
worksheet.Protection.AllowSelectingUnlockedCell = true;

Hope, this helps a bit.

Thank you for your help.


Good to know that your issue is sorted out now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.