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

Free Support Forum - aspose.com

Named Ranges

Aspose.Excel lets you create a named range in Excel by doing something like this…

Range range = cells.CreateRange(0,0,4,4);
range.Name = MyRange;

However, in Excel it is possible to have the same name for a named range on different worksheets. So worksheet1 can have the name MyRange as could worksheet2,3,4, etc. However, to do this you need to include a reference with the name like this…


Range range = cells.CreateRange(0,0,4,4);
range.Name = “’” + xlWorkSheet.Name + “’!MyRange”;

This is possible in VBA and using the interop assemblies but doesn’t work in Aspose.Excel.

Hi, thanks for your consideration.

Yes, currently Aspose.Excel doesn’t support named ranges as you described. I will add this feature in the next hotfix.

Laurence,

Thats great. Thanks for the quick response. Do you have an approximate release date for that hot fix?

Dear DigitalC,

Just about 10/10. OK?

Thats great, thank you.


Dear DigitalC,

Just a quick note: hot fix 1.6.1 will be out Monday, just 2 days later than expected.

Thanks for your patience.

Dear DigitalC,

HotFix 1.6.1 is released.

You can use the following code:

range.Name = sheet.Name + “!MyRange”;

@DigitalC,
Aspose.Excel is replaced with a highly efficient and feature-rich library Aspose.Cells. You can work with the named ranges with this latest library also as shown in the following sample code:

// Opening the Excel file through the file stream
Workbook workbook = new Workbook(dataDir + “book1.xls”);

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

// Creating a named range
Range range = worksheet.Cells.CreateRange("B4", "G14");

// Setting the name of the named range
range.Name = "TestRange";

// Saving the modified Excel file
workbook.Save(dataDir + "output.out.xls");

For more details have a look at the following article:
Create Access and Copy Named Ranges
Format and Modify Named Ranges

Download the latest version of Aspose.Cells for .NET from the following link:
Aspose.Cells for .NET (Latest Version)

You can download the latest demos here.