Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Created Unassigned: Failed address resolution by "[]" [15255]

$
0
0
When creating a named area in MS Excel application sometimes it puts empty square brakets at the beginning of the address string. I did not find out depending on what circumstances Excel does so. So I was able reproduce the error only sporadical.
In any case the error is reproduceble. Here is my suggestion for sulution:

The function __ExcelAddress.SetAddress(string address)__ I extended with the following two lines of code on the beginning:

```
if (address.Contains("[]"))
address = address.Replace("[]", String.Empty);
```

So the function looks like that afterall:

```
protected internal void SetAddress(string address)
{
//Sometimes (especially in named areas) excel puts empty brackets
if (address.Contains("[]"))
address = address.Replace("[]", String.Empty);
if(address.StartsWith("'"))
{
int pos = address.IndexOf("'", 1);
while (pos < address.Length && address[pos + 1] == '\'')
{
pos = address.IndexOf("'", pos+2);
}
var wbws = address.Substring(1,pos-1).Replace("''","'");
SetWbWs(wbws);
_address = address.Substring(pos + 2);
}
else if (address.StartsWith("[")) //Remove any external reference
{
SetWbWs(address);
}
else
{
_address = address;
}
if(_address.IndexOfAny(new char[] {',','!', '['}) > -1)
{
//elided..
```

Best regards,
Ivan

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>