I receive an InvalidOperationException: Collection was modified; enumeration operation may not execute when using WebWorksheets.ImportExcelFile(memorystream). This behaviour is with a specific xlsm file
Hi,
Thanks for posting your problem and using Aspose.Cells for GridWeb.
Please download and try the latest version:
Aspose.Cells
for GridWeb v2.7.3.2000
and let us know your feedback.
If the problem recurs, then please provide us your source xls/xlsx files and the sample code replicating the problem
Ok, will provide sample. We already use that version.
Sample xlsm file attached
code used
xlsm file is stored in DB as byte array
Dim myStream As System.IO.MemoryStream = New System.IO.MemoryStream(_request.PricingModelRequestData)
grdWeb.WebWorksheets.EnableIterativeCalculation = True
grdWeb.WebWorksheets.ImportExcelFile(myStream)
grdWeb.WebWorksheets.ActiveSheetIndex = 1
Hi,
The file is loading fine, below is my code.
Please also see the screenshot for a reference.
Please set the MemorySteam.Postion = 0 and see if it loads fine as shown in my code.
C#
string filepath = @“F:\Shak-Data-RW\Downloads\Job73±+AA+pricing+model+v+2012+02+20.xlsm”;
byte[] bytes = System.IO.File.ReadAllBytes(filepath);
//Create a memory stream
MemoryStream ms = new MemoryStream();
ms.Write(bytes, 0, bytes.Length);
ms.Position = 0;
this.GridWeb1.WebWorksheets.EnableIterativeCalculation = true;
this.GridWeb1.WebWorksheets.ImportExcelFile(filepath);
Screenshot:
Does it work when you change ImportExcelFile with the memorystream? so ms instead of filepath?
I did some extra testing, when I use ImportExcelFile with the filepath, i am getting the same error.
When I set enableAJAX = false the error is gone.
Thanks
Hi,
There are some issues when imported using memory stream. I have attached the screenshot for a reference.
Below is my code.
We have logged this issue in our database. Development team will look into this issue and once, the issue is fixed, we will update you asap.
This issue has been logged as CELLSNET-40426.
C#
string filepath = @“F:\Shak-Data-RW\Downloads\Job73±+AA+pricing+model+v+2012+02+20.xlsm”;
byte[] bytes = System.IO.File.ReadAllBytes(filepath);
//Create a memory stream
MemoryStream ms = new MemoryStream();
ms.Write(bytes, 0, bytes.Length);
ms.Position = 0;
this.GridWeb1.WebWorksheets.EnableIterativeCalculation = true;
this.GridWeb1.WebWorksheets.ImportExcelFile(ms);
Screenshot:
Hi,
We have fixed this bug: “shape file does not displayed correctly ”.
Please downlad and try the latest version: Aspose.Cells.GridWeb 2.7.5.2001
The issues you have found earlier (filed as CELLSNET-40426) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.