This project has moved. For the latest updates, please go here.

ExcelNamedRange missing RefersTo property

Aug 11, 2014 at 2:52 AM
Excel allows to specify any Excel Formula as Named Range's RefersTo value, without having to set an actual range.
E.g.
Name: OfficeFilter
Refers To: =T("Toronto Office")

How can I set this using EPPlus?

worksheet.Names.Add seems to require a valid ExcelRangeBase which I don't have in my case.

Note: When reading such a defined name, then EPPlus set the Formula attribute with the RefersTo value.
Aug 18, 2014 at 2:44 AM
I was able to get it working by adding this function to ExcelNamedRangeCollection:
    public ExcelNamedRange Add(string Name, string NameFormula)
    {
        ExcelNamedRange item;
        item = new ExcelNamedRange(Name, _wb, _ws, _dic.Count);
        item.NameFormula = NameFormula;

        AddName(Name, item);

        return item;
    }