Home » Developer & Programmer » Forms » Making exports to Excel faster (Forms
Making exports to Excel faster [message #379380] Tue, 06 January 2009 04:33 Go to next message
Messages: 1
Registered: January 2009
Junior Member

I'm exporting data from forms to Excel using client_ole2. It works fine
but the performance is so terrible, its so slow. Is there any way to
improve it ? When doing the same thing in Delphi I used VarArray to
dump all data in it and than sending it to Excel in one pass, this way
even a lot of data was exported very quickly, it looked like this:

arrData: Variant;
arrData := VarArrayCreate([1, yourStringGrid.RowCount, 1,
yourStringGrid.ColCount], varVariant);

{fill array}
for i := 1 to yourStringGrid.RowCount do
for j := 1 to yourStringGrid.ColCount do
arrData[i, j] := yourStringGrid.Cells[j-1, i-1];

{initialize an instance of Excel}

{retrieve a range where data must be placed}
Range := wb.WorkSheets[1].Range[wb.WorkSheets[1].Cells[1, 1],
wb.WorkSheets[1].Cells[yourStringGrid.RowCount, yourStringGrid.ColCount]];

{copy data from allocated variant array}
Range.Value := arrData;


This method doesn't want to run in Forms, because CLIENT_OLE2.SET_PROPERTY doesnt want
to accept any arrays. Do anybody know how to make export through client_ole2 much
faster ?

"how far can they control my mind"
Re: Making exports to Excel faster [message #380001 is a reply to message #379380] Thu, 08 January 2009 18:43 Go to previous message
Messages: 10180
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Then use Delphi, or utl_file to a 'csv' file, or search this forum for 'excel again' and look at the list of good Excel topics and see if they contain any hints.

Previous Topic: Calling tibco webservice from Forms
Next Topic: Mouse doesnt work after scrolling
Goto Forum:

Current Time: Wed May 24 04:54:38 CDT 2017

Total time taken to generate the page: 0.28638 seconds