Hello All, Could somebody can show me a short example how to export a dbgrid to a simple text file (comma separated)? I did not find any. There is already an article explaining how to export from THTMLViewer using eDocEngine. However, it tried to solve a bit more complicated. Exporting a DBGrid to excel without OLE I develop software and about 95% of my work deals with databases. I enjoied the advantages of using Microsoft Excel.

Author: Votaur Grojind
Country: Brazil
Language: English (Spanish)
Genre: Travel
Published (Last): 18 June 2012
Pages: 138
PDF File Size: 18.46 Mb
ePub File Size: 19.38 Mb
ISBN: 973-9-37727-530-6
Downloads: 27276
Price: Free* [*Free Regsitration Required]
Uploader: Kakree

TObject ; var Lista: I need to export the contents of a dbGrid to a CSV file. I have the feeling that I’m reinventing the wheel No, his code takes that into account: The ‘try’ is in the wrong place, though.

I’m afraid I don’t undestand this point. Quote Sergio Gonzalez wrote: EnableControls can raise an exception since it causes the screen to update, delpyi. So I made it last so that Lista doesn’t leak if it does raise an error.


Sergio Gonzale Delphi Developer. All are very good points The downside of your approach is that its not reusable, IMO a better route is to have a procedure you can use to handle it.

Reproduced Delphi DBGrid derived Excel method

The grid is a kind of “preview” and the user can choose the order in wich the fileds will be exported, by changing the field’s order in the grid. That’s why I use a dbGrid Thanks exporr the procedure! I will save it for future use.

CSV from a text file into a record structure 7. CSV File Access Mon, 23 Aug I did this procedure and so far it works fine. I’m just curious if that’s the best way to do it As the DBGrid might have a different set of fields then the original resultset you need to access these.

I would write a generic procedure taking the dbgrid as a parameter and then follow the properties to retrieve header and data. Exporting can be done this way, but you can also use tstringlist. Or directly write to file with AssignFile etc.


Paul Scot Delphi Developer. Tue, 24 Aug Rich Wernin Delphi Developer. Sun, 29 Aug