TAdvGridExcelIO terrible slow

Hi,

I am wondering: Which version of Delphi are you using?   WriteRawMem should be fast as fast can be, it is the method that actually writes the bytes for the xls file into the stream - and being called  11171 times, when you are writing 700x 4 = 2100 cells isn't much at all. If you look at the code, you'll see that WriteRawMem just calls:

FStream.WriteBuffer(Buffer, Count);

Which in turn saves the file to disk. We can't get any faster than that to write bytes to disk.

So either the profiler is getting confused and the time is spend elsewhere, or there is a problem in WriteRawMem. And this is why I ask the version of Delphi you are using.

There was a change in XE3 which made TStream.WriteBuffer much slower;
https://forums.embarcadero.com/thread.jspa?threadID=85011

And maybe this is why you are seeing this. IF you are in XE3, there is also this:
http://qc.embarcadero.com/wc/qcmain.aspx?d=112339

If this is the case, you might want to patch the VCL to make WriteBuffer fast again.

Another thing to try if the problem is really in writebuffer could be an antivirus which is constantly "examining" the bytes as they are written, if you have it turn it off and retry. 

A last thing: While I originally thought that you might just be writing too much data and this why the slowness (after all, as I explained before filling a dataset with the database, then filling up a grid, thern reading the grid and exporting it to Excel will always be slower than just reading the values form the db and writing them in Excel), I think that maybe there can be something else.

So I'd like you if possible to install the FlexCel 6 trial and the filters, and report if you see the same times, or if it is faster. FlexCel 6 workarounds the WriteBuffer bug I mentioned here, so if that is the problem, it should be much faster. If it is as slow, then the problem is somewhere else

Regards,
    Adrian.