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

Free Support Forum - aspose.com

Named ranges with formulas

I have excel file created with MS Excel 2000. It contains 4 named ranges and some of them are difined with formulas. If I use GetNamedRanges() it returns the correct count of objects but some have no values (=null).
Is there any ability to make it working?



Hi Boris,

Could you elaborate your problem? And please zip you project and designer file to me. That will help me to investigate it.


Aspose.Excel is discarded and no more development is done for it. It is replaced by an advanced product Aspose.Cells that supports all the latest features provided by different versions of MS Excel. We can set complex formulas for named ranges. Here is an example which demonstrates this feature using this new product:

// Create an instance of Workbook
Workbook book = new Workbook();

// Get the WorksheetCollection
WorksheetCollection worksheets = book.Worksheets;

// Add a new Named Range with name "NewNamedRange"
int index = worksheets.Names.Add("NewNamedRange");

// Access the newly created Named Range
Name name = worksheets.Names[index];

// Set RefersTo property of the Named Range to a formula. Formula references another cell in the same worksheet
name.RefersTo = "=Sheet1!$A$3";

// Set the formula in the cell A1 to the newly created Named Range
worksheets[0].Cells["A1"].Formula = "NewNamedRange";

// Insert the value in cell A3 which is being referenced in the Named Range
worksheets[0].Cells["A3"].PutValue("This is the value of A3");

// Calculate formulas

// Save the result in XLSX format
book.Save(dataDir + "output_out.xlsx");

For more information about the named ranges follow the link below:
Setting formula for named ranges

A free trial version is available here for testing the product features:
Aspose.Cells for .NET (Latest Version)

A complete runnable solution can be downloaded here to test the product features with the help of hundreds of ready to run examples.