Free Support Forum - aspose.com

CopyRow Index/Argument out of range bug is back

I tried upgrading my Visual Studio 2008 project from version 4.4.0 of Apose Cells to 4.4.1 yesterday. Prior to the update, the CopyRow function I was using to copy rows as needed to accomodate data (complete with formatting)from lower row numbers to higher row numbers, was working just fine.

As soon as I started using the latest downloaded version I began getting errors such as Index Out of Range.

When I rolled back to the 4.4.0 version the problem went away.

Below the dashes in this post is an excerpt from a 2006 post in which a similar thing occurred and the problem was fixed in the next release. I am posting to let you guys know that the problem is back again, I will stay with 4.4.0 until the bug is fixed.

The error messages from my CopyRow error may have been a little different, but the problem is almost identical. See the excerpt below from a post in 2006.

--------------------------------------

Aspose.Cells Error with Worksheet.Cells.CopyRow

I have a new error working with Version 4.0.2.6 and 4.0.2.0
It works just fine using version 3.7.1.0

This happens in both single threaded and multi-threaded execution.
Here is the line of code I am executing

workSheet.Cells.CopyRow(workSheetTemplate.Cells, 8, 35);

The usually execption this is thrown is "ArgumentOutOfRangeException"

Error: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Data: System.Collections.ListDictionaryInternal
Target: System.Object get_Item(Int32)
Stack: at System.Collections.ArrayList.get_Item(Int32 index)
at Aspose.Cells.Style.GetStyle(Worksheets sheets, Int32 xfIndexRead)
at Aspose.Cells.Cell.get_Style()
at Aspose.Cells.Cells.CopyRow(Cells sourceCells, Int32 sourceRowIndex, Int32 destinationRowIndex)
at ICE.Net.Reporting.ExcelWorkItem.ProcessBreakLevelDetail(SmartTags stSmartTag) in C:\Documents and Settings\prjdo000\My Documents\Visual Studio 2005\Projects\IC_Report\IC_Report\ExcelWorkItem.cs:line 646
-------------------------------------

Thank you...

Hi,

Could you try the attached version (4.4.1.17) as I tested the CopyRow method and it works fine here.

If you still find the problem, kindly post your template excel file and sample code to reproduce the issue.

Thank you.

Thank you Amjad,

Version 4.4.1.17 seems to work just fine with CopyRow in my application.

Not only that, but now the Merged Cells appear to be resizing themselves nicely when they are populated with different amounts of text formatted as General. In the previous version those sames rows of Merged Cells were not resizing. They are even leaving a nice empty row border at the bottom of the cell. Great!

Don't I wish I had waited until today to update Apose Cells. That would have saved me hours of work needlessly debugging my code on Friday...when the code was actually just fine.

But I guess the new features are worth it.

P.S. The next time I do an update I will re-compile and test my code immediately, and then if there is an error, I will roll back to the previous version and see if that fixes the problem.

Keep up the good work!

Hi,

Could you post your sample codes and template file? We will check it soon.