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

Free Support Forum - aspose.com

Worksheet specific named ranges

I see in http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/named-ranges.html that I can get the specified named range of a workbook but what if I want to find a sheet specific named range? is there a way to do that?

so instead of looking at all the worksheets.

//Getting the specified named range

Range range = workbook.Worksheets.GetRangeByName("TestRange");

I want to look at 1 specific worksheet as the same named range may be in several worksheets in the workbook

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, in case of sheet specific named ranges, you can get the range by using the same method

workbook.Worksheets.GetRangeByName("Sheet1!TestRange"), but you have to make sure that when the

sheet specific range is created , it should also use the sheet name as prefix. Please see the following

sample code,

Sample Code:
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
//Create a named range
Range range = sheet.Cells.CreateRange("B1", "E5");
//Set the name of the named range
range.Name = sheet.Name + "!" + "TestRange";
//Get the sheet specific range and assign to range 2
Range range2 = workbook.Worksheets.GetRangeByName(sheet.Name+"!" + "TestRange");

Thank You & Best Regards,