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

Created Unassigned: Saved ExcelRange with array value gets the array type saved as its value. [15460]

$
0
0
In Excel, if a range gets its value set to an array, only the first value is saved as the cell value.
In EP Plus, the range value gets saved as the ToString() representation of the object, in this case the array type.
See the following example:

```
FileInfo file = new FileInfo("report.xlsx");
using (ExcelPackage package = new ExcelPackage(file))
{
var sheet = package.Workbook.Worksheets.Add("New Sheet");
sheet.Cells[3, 3].Value = new[] { "value1", "value2", "value3" };
package.Save();
}
using (ExcelPackage package = new ExcelPackage(file))
{
var sheet = package.Workbook.Worksheets["New Sheet"];
if (!sheet.Cells[3, 3].Value.Equals("value1"))
throw new Exception("Why is the value System.String[]?");
}
```

Once the ExcelPackage has been saved, the value in the cell should be the first value in the array to which it was assigned.

Viewing all articles
Browse latest Browse all 2262

Trending Articles



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