Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

Closed Unassigned: Bug using LEFT() function on empty string [9362]

$
0
0
It seems to me there is a bug in ClosedXML.Excel.CalcEngine.Text.Left method.

In an excel cell, if we write formula:
```
=LEFT(A1)
```
and when A1 cell contains empty string, it fails:
> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at ClosedXML.Excel.CalcEngine.Text.Left(List`1 p)

Before calling String,Substring, there should be some code to return the p[0] string if n is greater than p[0] length.
Comments: Pick up the latest source code. I only fixed Left, Right, and Mid. I'll check the rest of the text functions later.

Viewing all articles
Browse latest Browse all 1877

Trending Articles



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