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: Saramar Kazrasar
Country: Guinea-Bissau
Language: English (Spanish)
Genre: Medical
Published (Last): 19 July 2010
Pages: 460
PDF File Size: 6.26 Mb
ePub File Size: 15.30 Mb
ISBN: 916-5-61073-532-5
Downloads: 49553
Price: Free* [*Free Regsitration Required]
Uploader: Mautaur

I’m afraid I don’t undestand this point.

delphi – Exporting data from a DBGrid to Excel – Stack Overflow

Sign up using Facebook. I too was going to give the reference that Bummi gave. The downside of your approach is that its not reusable, IMO a better route is to have a procedure you dbgrud use to handle it. I’m just curious if that’s the best way to do it Post Your Answer Discard By clicking “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy policy and cookie policyand that your continued use of the website is subject to these policies.


Thanks for the procedure! Do not export the DBGrid, export the dataset stackoverflow. I have the feeling that I’m reinventing the wheel TObject ; var Stream: If you want a fast export of raw data, just export your recordset ADODataset.

If you dont have a recordset, you have to iterate your dataset and write excel accesing cells. That’s why I use a dbGrid Mon, 23 Aug 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.

As the DBGrid might have a different set of fields then the original resultset you need to access these.

Next; end; finally Stream. No, his code takes that into account: EnableControls can raise an exception since it causes the screen to update, indirectly. By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. Stack Overflow works best with JavaScript enabled. I did this procedure and so far it works fine.

Rich Wernin Delphi Developer. Tue, 24 Aug FieldCount – 1 do begin S: Any help will be appreciated. CSV from a text file into a record structure 7. All are very good points Okay I will go have a look at that. There’s hits on a Google search for “delphi export dbgrid excel”.


Other Threads

I will save it for future use. FieldName ; for I: CSV File Access FieldCount – 1 do begin sTemp: It is working by using Tfilestream component procedure TForm2. I suggest you start using these, then if you have specific questions about code parts not working, post them here. TObject ; var Lista: Paul Scot Delphi Developer. Sign up using Email and Password. Sun, 29 Aug So I made it last so that Lista doesn’t leak if it does raise an error.

Sergio Gonzale Delphi Developer. And if We want export an ClientDataset to Excel then what we do?

In order to use the variant array approach, you have to know how many rows you have in the query.