GetNamedRanges throws exception

I tried the newest hotfix (3.0.4.0) and I’m having problem with it.
GetNamedRanges throws an exception.
Sample source code:

Aspose.Excel.Excel xls=new Aspose.Excel.Excel();
xls.Open(“C:\temp\AsposeError.xls”);
Aspose.Excel.Range[] rngs1=xls.Worksheets.GetNamedRanges();

I attached my xls that Aspose.Excel is having problem with.

Regards,
Grzegorz Chlodzinski

This error is caused by one of your defined name referring to a range on a deleted worksheet. I fixed this problem and you will get the hotfix next week.

Please download and try v3.0.5 at

It’s working now. Thanks!

@GrzegorzChlodzinski,
Aspose.Cells has replaced Aspose.Excel that is no more under development and is discarded. The new product has all the features of its predecessor along with the support for the latest features available in different versions of MS Excel. New ranges can be added and accessed using Aspose.Cells and also care is taken to manage the named ranges incase of deletion. Here is a sample code that demonstrates this feature in detail:

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET

// Opening the Excel file through the file stream
Workbook workbook = new Workbook();

int index = workbook.Worksheets.Add();
// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[index];

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

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

// Getting the specified named range
range = workbook.Worksheets.GetRangeByName("TestRange");

if (range != null)
    Console.WriteLine("Named Range : " + range.RefersTo);
else
    Console.WriteLine("Named range is not available");

//Delete the first worksheet now
workbook.Worksheets.RemoveAt(index);

// Getting the specified named range
range = workbook.Worksheets.GetRangeByName("TestRange");

if (range != null)
    Console.WriteLine("Named Range : " + range.RefersTo);
else
    Console.WriteLine("Named range is not available after deleting the respective sheet");

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

Program Output

Named Range : =Sheet2!$B$4:$G$14
Named range is not available after deleting the respective sheet

Refer to the following articles for more information about the ranges:
Create Access and Copy Named Ranges
Format and Modify Named Ranges
Setting Formula for Named Range
Preserve Single Quote Prefix of Cell Value or Range
Get Address Cell Count Offset Entire Column and Entire Row of the Range
Create Union Range

Give a try to Aspose.Cells by downloading it from the following link:
Aspose.Cells for .NET (Latest Version)

A ready to run solution is available here that can be used to test the variety of features of this new product.