I am trying to create an export that can either be used by filling a template or without an template. If there is no template, I create a default template an fill that. Every template has a NamedRange called TemplateRow that defines the row where data is
supposed to be inserted. Adding a NamedRange seems to work, but when I try to fetch the Ranges from a NamedRange I get a "the sequence is empty" exception. Here's what I do:
var newTestRange = wb.NamedRanges.Add("TestRange", ws.Range(ws.Cell(1, 1), ws.Cell(1, 7)));
var nR = wb.NamedRange("TestRange");
var range = nR.Ranges.Single()
The last line throws an InvalidOperationException. Looking at the code it seems that in XLNamedRange.cs the Ranges property getter does some filtering-grouping-regex magic I don't quite understand which causes my single range not to be added. In the debugger
I can see that the internal list (_rangeList) contains the item I want.
Any Hints? Thank you for your support!