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

Commented Unassigned: Index was out of range. Must be non-negative and less than the size of the collection. After call to GetAsByteArray() [15019]

$
0
0
I'm using EPplus to edit excel (xlsx) files
But there is error when i try to edit 2 files.
Error disappeares when i copy data from sheet to another sheet, but i can't understand what is the cause

public FileInfo ApplyChanges(string path, string sheetName, RowChange change)
{
ExcelPackage package;
using (var ms = new System.IO.MemoryStream(_fileProvider.Download(path)))
{
package = new ExcelPackage(ms);
}
var fileInfo = _fileProvider.GetFileInfo(path);
var excelSheet = package.Workbook.Worksheets[sheetName];
foreach (var columnChange in change.ColumnChanges)
excelSheet.Cells[change.RowId, columnChange.ColumnId].Value = columnChange.Value;
_fileProvider.Upload(fileInfo.Path, fileInfo.Name, package.GetAsByteArray());
fileInfo = _fileProvider.GetFileInfo(fileInfo.Path);
return FileInfo.Copy(fileInfo);
}

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

stack trace

at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at OfficeOpenXml.ExcelStyleCollection`1.get_Item(Int32 PositionID)
at OfficeOpenXml.ExcelStyles.RemoveUnusedStyles()
at OfficeOpenXml.ExcelStyles.UpdateXml()
at OfficeOpenXml.ExcelWorkbook.Save()
at OfficeOpenXml.ExcelPackage.GetAsByteArray(Boolean save)
at OfficeOpenXml.ExcelPackage.GetAsByteArray()
at TableViewer.BL.ExcelWrappers.ExcelDocumentProvider.ApplyChanges(String path, String sheetName, RowChange change) in c:\Users\yakunina\Desktop\tableviewer\TableViewer.BL\ExcelWrappers\ExcelDocumentProvider.cs:line 81
at TableViewer.BL.SheetProvider.UpdateRemoteAndLocal(BLSheet sheet, Int32 dbSheetId, RowChange rowChange) in c:\Users\yakunina\Desktop\tableviewer\TableViewer.BL\UnifiedSheetProvider\SheetProvider.cs:line 145
at TableViewer.BL.SheetProvider.Update(Int32 id, RowChange rowChange) in c:\Users\yakunina\Desktop\tableviewer\TableViewer.BL\UnifiedSheetProvider\SheetProvider.cs:line 134
at TableViewer.WebService.Controllers.DatasForColumnController.Post(ChangesDTO changes) in c:\Users\yakunina\Desktop\tableviewer\TableViewer.WebService\Controllers\DatasForColumnController.cs:line 73
at lambda_method(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClassf.<GetExecutor>b__9(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4()
at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)
Comments: Fixed in commit c35695785810

Viewing all articles
Browse latest Browse all 2262

Trending Articles



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