August 19, 2021 By admin 0


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: Mazular Zolorisar
Country: Austria
Language: English (Spanish)
Genre: Marketing
Published (Last): 26 March 2018
Pages: 243
PDF File Size: 5.86 Mb
ePub File Size: 14.30 Mb
ISBN: 367-6-31148-958-7
Downloads: 6171
Price: Free* [*Free Regsitration Required]
Uploader: JoJomuro

CSV from a text file into a record structure 7.

dbgrid to CSV – delphi

Sign up using Email and Password. I did this procedure and dbgrif far it works fine. By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. Sun, 29 Aug And bummi’s right; if at all possible export the underlying dataset. There’s hits on a Google search for “delphi export dbgrid excel”. I’m afraid I don’t undestand this point. Paul Scot Delphi Developer.

The ‘try’ is in the wrong place, though. So I made it last so that Lista doesn’t leak if it does raise an error.

Otherwise it may be simpler to use the csv approach which I gave in that question. If you dont have a recordset, you have to iterate your dataset and write excel accesing cells. Mon, 23 Aug TObject ; var Stream: FieldCount – 1 do begin S: Exporting can be done this way, but you can also use tstringlist. I would write a generic procedure taking the dbgrid as a parameter and then follow the properties to retrieve header and data.

  BGI 7009 PDF

TObject ; var Lista: I’m just curious if that’s the best way to do it FieldName ; for I: I too was going to give the reference that Bummi gave. Quote Sergio Gonzalez wrote: Post Your Answer Discard By clicking “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy delpho and cookie policyand that your continued use of the website is subject to these policies.

Any help will be appreciated.

Other Threads

The grid is a kind of “preview” and the user can choose the order in wich the fileds will be exported, by changing dlphi 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. Okay I will go have a look at that. And if We want export an ClientDataset to Excel then what we do?

Reproduced Delphi DBGrid derived Excel method

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. If you want a fast export of raw data, just export your recordset ADODataset. Stack Overflow works best with JavaScript enabled. Do not export the DBGrid, export the dataset stackoverflow. Thanks for the procedure! Sergio Gonzale Delphi Developer.


Tue, 24 Aug All are very good points In order to use the variant array approach, you have to know how many rows you have in the query. I have the feeling that I’m reinventing the wheel EnableControls can raise an exception since it causes the screen to update, indirectly. 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.

I suggest you start using these, then if you have specific questions about code parts not working, post them here. Or directly write to file with AssignFile etc.

CSV File Access FieldCount – 1 do begin sTemp: FieldName ; end; s: Email Required, but never shown. I need to export the contents of a dbGrid to a CSV file. Next; end; finally Stream.

Rich Wernin Delphi Developer. FieldCount – 1 do begin s: That’s why I use a dbGrid