Invalid column index: "36768"

I have Flexcel 6.2.



On the production this is working well.



On UAT, this no longer works since January 13th, 2016.



We have the same data on both environments. We also have the same components.



The exception is:



Invalid column index: "36768"    at FlexCel.XlsAdapter.XlsFile.IsUriAllowable(Int32 RangeStart)

   at FlexCel.XlsAdapter.XlsFile.SetColWidth(Int32 col, Int32 width)

   at Framework.Report.Report()



This is a very big dataset. The number of records is 36768. The number of fields is 116.



On UAT, the server processing that is:



Windows Server 2008 R2 Standard SP1

2.8 Ghz 2 Intel Xeon

8 GB of RAM



On production, the server processing that is:



Windows Server 2008 R2 Standard SP1

2.8 Ghz 2 Intel Xeon

16 GB of RAM



Did we face a limit in Flexcel in the amount of RAM required to process that big file?





Hi,


This doesn't look like a memory problem, but something in the template. The file is big indeed, but we deal with much larger files (near the million rows) regularly without issues.

From what I get from the message, it is trying to set the column width in column 36768, which is as you would expect an error,  since the maximum number of columns possible in Excel is 16384.

But the question is why it is trying to set the column width in col 36768 when this seems to be the number of rows, not columns. Can you send me the template that is causing issues to adrian@tmssoftware.com so I can take a look?

Yes, there is a mixup somewhere.



This is the code portion that deals with it:



            ' Reset the values

            lnColumn = 0



               oApp.AddLog(1, "Column: " + oColumn.ToString)



            ' For each column

            For Each loObject In oColumn



                    ' Initialization

                    lnWidth = loObject(3)



               ' Initialization

               lnColumn = lnColumn + 1



                    oApp.AddLog(1, "Column inside For Each: " + lnColumn.ToString)



               ' If we have a width

               If lnWidth > 0 Then



                         oApp.AddLog(1, "Column inside For Each with the width: " + lnColumn.ToString)



                         ' Set the column width

                         oXlsFile.SetColWidth(lnCounter, lnWidth)



                    Else



                         ' Auto fit the column

                         oXlsFile.AutofitCol(lnColumn, False, 1.1)



                    End If



               Next



I added AddLog() so I can see the values of the lnColumn variable.



At the time of the error, this is at column #9. So, the value of lnColumn is 9. The error says 36768. Columns #1 to #8 do not set the width, so they do not go in that If portion. So, the Else for AutoFitCol() works well for columns #1 to #8. Then, at column #9, as I have a width I need to define, it goes in there and there is the error.



So, even if I am a column 9, something is mixup in the error message thinking it is in reality 36768.

Ok, after revision, lnColumn was supposed to used for the variable and not lnCounter.



That explains.



The fact that this works in production remains a mystery.



But, I am to deploy.



Thanks