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

Commented Unassigned: AutoFitColumns - Numberformat - the format string is deleted [15110]

$
0
0
Hi,
i've been getting this error with the version 4 of 11 november :

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

en System.Text.StringBuilder.Insert(Int32 index, Char* value, Int32 valueCount)
en System.Text.StringBuilder.Insert(Int32 index, Char value)
en OfficeOpenXml.Style.XmlAccess.ExcelNumberFormatXml.ExcelFormatTranslator.ToNetFormat(String ExcelFormat, Boolean forColWidth)
en OfficeOpenXml.Style.XmlAccess.ExcelNumberFormatXml.ExcelFormatTranslator..ctor(String format, Int32 numFmtID)
en OfficeOpenXml.Style.XmlAccess.ExcelNumberFormatXml.get_FormatTranslator()
en OfficeOpenXml.ExcelRangeBase.GetFormattedText(Boolean forWidthCalc)
en OfficeOpenXml.ExcelRangeBase.get_TextForWidth()
en OfficeOpenXml.ExcelRangeBase.AutoFitColumns(Double MinimumWidth, Double MaximumWidth)
en OfficeOpenXml.ExcelRangeBase.AutoFitColumns(Double MinimumWidth)
en OfficeOpenXml.ExcelRangeBase.AutoFitColumns()


Style.Numberformat.Format = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""??_);_(@_)"

```
//Add qoutes
if(lstDec.Count>1)
{
for(int i=lstDec.Count-1;i>=0;i--)
{
sb.Insert(lstDec[i] + 1,'\'');
sb.Insert(lstDec[i],'\'');
}
}
```


Line 352
```
if (c == ';') //We use first part (for positive only at this stage)
{
secCount++;
if (DataType == eFormatType.DateTime || secCount == 3)
{
format = sb.ToString();
sb = new StringBuilder(); // ??
}
else
{
sb.Append(c);
}
}
else

```

sb.ToString() --> "{0}"
sb.Capacity --> 16
sb.Length -->3

i --> 1
lstDec[i] --> 15
lstDec[i] + 1 -->16
sb.Insert(16,'\'');


Thanks for checking out this issue.
Comments: Fixed in changeset c6c16f4d9f16

Viewing all articles
Browse latest Browse all 2262

Trending Articles



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