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

Free Support Forum - aspose.com

Desktop Grid - Invalid Outfit Range

Hi

My following statement is running in a loop which Autofits the columns, but when the loop reaches at 33 and tries to run following statement, it gives the error - Invalid Outfit Range
ActiveWorksheet.AutoFitColumn(lCol)

Could you please tell me how to fix this issue.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, this error may be occurring due to the fact that the grid has max specified columns as 33 (as index starts from 0) , so when your loop reaches 33 (means 34th column) it gives this exception. If this is not the issue then please share more details about your Grid, so we can figure out this issue soon (May be create a sample application and post it here).

Thank You & Best Regards,

Yes, You are right. but how can I set the columncount on the fly. I tried with following statement, but it did not work.

grdDataEntry.Worksheets(0).ColumnsCount = 40

Yes, its done. I was using that statement at wrong place. thanks