The simplified code below takes a long time to execute
Up to 0.6 seconds for a single iteration. That is 10 minutes in total for a 1000 lines.
It used to be real fast :-/
dim lastRecordNumber as Integer = 999
for recordNumber as Integer = 0 to lastRecordNumber
if (recordNumber= 0) OR (recordNumber mod 10) = 0 OR (recordNumber= lastRecordNumber) then
system.debuglog("Exporting record "+str(recordNumber)+"/"+Str(lastRecordNumber))
end if
dim ioRecord as DatabaseRecord = IOdata(recordNumber)
dim rowNumber as Integer = recordNumber+6 // Keep a Header of 6 lines
dim currentRow as ExcelRange = app.excel.Rows(rowNumber) // a Global instance of ExcelApplication
currentRow.Columns("A") = "aValueForColumnA"
currentRow.Columns("B") = "aValueForColumnB"
currentRow.Columns("C") = "aValueForColumnC"
currentRow.Columns("D") = "aValueForColumnD"
next recordNumber
Neil may be correct that the computer might be slow, or another possibility is that accessing data from the database might be slow. I modified your program and the below code populates 1000 rows with 4 columns and it takes about 10 seconds on my computer.
[code]Dim Excel as new ExcelApplication
Excel.Visible = True
Excel.Workbooks.Add
system.debuglog("Start exporting records ")
for recordNumber as Integer = 0 to 1000
@Jan Verrept - you could also consider using Einhugur Excelwriter / Excelreader plugin.
No need for having Excel installed on the same machine and, as far as I know, you can just try these plugins for free.
or the control is attempting to do a complete redraw each time you add a row, when in fact you don’t need it to redraw until you have finished populating it.?