Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Error looping through excel rows
posted

I am using Infragistics4.Documents.Excel.v11.2 to create an excel spreadsheet.  I am able to load all of the data correctly.  I then go to format the sheet and set the font.  Using this code:

 

'Sheet is already populated

Dim sheet As Worksheet

For Each row as WorksheetRow in sheet.Rows

    For Each cell as WorksheetCell in row.Cells

        cell.CellFormat.Font.Name = "Trebuchet MS"

    Next

Next

 

As I'm processing the second row, the cell Next statement throws the exception:

Collection was modified after the enumerator was instantiated.

 

Stack Trace:

   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)

   at System.Collections.Generic.SortedList`2.Enumerator.MoveNext()

   at Infragistics.Documents.Excel.WorksheetRow.<GetCellsWithData>d__a.MoveNext()

   at Infragistics.Documents.Excel.WorksheetCellCollection.<GetEnumeratorHelper>d__0.MoveNext()

   at ConsoleApplication1.Module1.Main()

 

Any ideas what is causing this error to be thrown?

 

 

Parents
No Data
Reply
  • 53790
    posted

    Hello,

    I try to reproduce your issue in a small sample, but without success. Could you please take a look at the attached sample and video file and please feel free to modify this sample to reproduce your issue and revert it back to me. I`ll be glad to research your issue.  Also please tell me do you have any installed service release and which one.

    Let me know if you have any questions.

    Regards

    WorksheetExcelExport_5.zip
Children