Range not in opened workbook

I have an Excel workbook that has a named range on a worksheet. When I open the Excel in Aspose.Cells, there are no ranges defined on any worksheet.


Does the Aspose.Cells not read existing named ranges when a workbook is opened?


Hi,


Sure, it does, you may read and write named ranges using Aspose.Cells APIs, see the topic for your reference:
http://www.aspose.com/docs/display/cellsnet/Named+Ranges

If you still have any issue or confusion, please give us your template file and paste your sample code, we will check your issue soon.

Thank you.

Great, that worked! I did not notice that method.


It appears the range properties are read-only. I’m looking to open the workbook, populate the data, and update the range dimensions (i.e. number of rows). I’m hoping that other worksheets in the workbook (pivot tables, charts, etc). will automatically reflect the updated range.

Is that possible?

Thanks,

Hi,


Well, I think you may use NameCollection / Name objects to accomplish your task (i.e…, update range’s areas etc.) for your named ranges,
e.g

NameCollection names = workbook.Worksheets.Names;
Name name = names[“MyRange”];
name.RefersTo = “=Sheet1!$B$2:$B$3”;

//…

Thank you.

Hi,


I was on vacation, and am just returning today.

Unfortunately, the RefersTo is a read-only property.

Other suggestions?

Paul
Hi,

Please use NameCollection / Name objects to accomplish your task and try Name.RefersTo and not Range.RefersTo which is actually a read only attribute.

See the sample code below.
e.g

NameCollection names = workbook.Worksheets.Names;
Name name = names["MyRange"];
name.RefersTo = "=Sheet1!$B$2:$B$3";

//.......


If you still have any confusion let us know.

Thank you.