We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error Inserting Rows using

Using 8.0.1.3 the following code throws an exception while inserting rows. (see attached image).





I have not been able to provide any further detail at this stage, however hopefully this information is enough for you to track down the issue. I note from the release notes of version 8, that the mechanics behind RowCollection have changed, and I am assuming this exception is related to those changes.





This is the code that causes the exception:





Worksheet.Cells.InsertRows(21, 24);





This is the Stack Trace at the point the exception is thrown:





at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)\r\n

at System.Collections.Hashtable.Add(Object key, Object value)\r\n

at Aspose.Cells.RowCollection.(Int32 , Int32 , Int32 )\r\n

at Aspose.Cells.RowCollection.(Int32 , Int32 , ​ )\r\n

at Aspose.Cells.Cells.(Int32 , Int32 , ​ )\r\n

at Aspose.Cells.Cells.InsertRows(Int32 rowIndex, Int32 totalRows)\r\n

Hi Michael,


Thank you for contacting Aspose support.

We have evaluated your presented scenario on our end while using the latest version of Aspose.Cells for .NET 8.0.1.3 and a sample of our own. Unfortunately, we are unable to experience any exception. In order to move forward with your inquiry, we would request you to please share your sample spreadsheet as well as the complete code snippet to replicate the problem on our side.

As soon as we receive the requested information, we will re-evaluate the problem and log appropriate ticket for correction purposes, if applicable.

Hello Babar,

It is a bit difficult to provide a narrowed down version of the code, as it occurs in our product that is over 40 thousand lines of code.

I have tried to narrow it down, but that has proved difficult. I have tried saving the Workbook (using Aspose) prior to the call that causes the exception, and then re-opening it and running the offending code, but this works ok. I am assuming because your internal HashTable gets re-established on the Open.

As the exception is occurring in your code (looking like trying to add a key that already exists), could I ask you to take a look how this could occur within your code.

Alternatively maybe if you could provide me with the debugging symbols I might be able to narrow it down for you.

Thanks for looking into it, and hopefully we can get it resolved one way or the other.

Regards,

Mike

Hi Mike,


Thank you for your analysis of the situation.

We have logged an investigative ticket (CELLSNET-42596) based on the information shared here, and requested the development team to analyze the presented scenario. As soon as we receive any updates in this regard, we will post here for your kind reference.

We are still unable to reproduce the exception, even though we have executed the below provided code snippet on a spool of almost 200 spreadsheets. We now suspect that the presented problem could be template specific that is the reason we are unable to see it. Based on our test results, we would request you again to provide the sample spreadsheet along with code snippets to replicate the exception. Please note, providing the requested information will simply speedup the correction process, and we may be able to provide the fix with our weekly maintenance releases. On the other hand, without having the supporting documents/code, we may not be able to pin point the problem cause therefore we may not be able to promise a fix at earliest.

C#

var files = Directory.GetFiles(myDir, “.”);
foreach (var file in files)
{
var book = new Workbook(file);
book.Worksheets[0].Cells.InsertRows(21, 24);
}

Thanks Babar, I have installed 8.0.2 and run against my code base and cannot reproduce these issues with that version of Aspose Cells. (My code base is the same as when I initially raised the issue). I’m guessing that although these issues 42599 and 42596 were not specifically mentioned in the list of changes/fixes for 8.0.2, they have somehow been found and fixed, or related to some of the fixes specifically mentioned in the 8.0.2 release notes…??? Are you able to confirm…??? Cheers, Mike

Hi Mike,


Please refer to your other thread on the same note. Thank you.