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: Natilar Yoktilar
Country: Benin
Language: English (Spanish)
Genre: Science
Published (Last): 16 October 2018
Pages: 374
PDF File Size: 7.9 Mb
ePub File Size: 16.25 Mb
ISBN: 348-5-90948-730-4
Downloads: 22614
Price: Free* [*Free Regsitration Required]
Uploader: Tygolar

Sign up using Facebook. FieldName ; end; s: Mon, 23 Aug Thanks for the procedure! Sergio Gonzale Delphi Developer. Sun, 29 Aug No’amNewman depending delphk the datataypes the csv approach might give more trouble in convertions e. As the DBGrid might have a different set of fields then the original resultset you need to access these.

Reproduced Delphi DBGrid derived Excel method

And if We want export an ClientDataset to Excel then what we do? Stack Overflow works best with JavaScript enabled. Post as a guest Name.

  DOD 5000.1 PDF

Sign up or log in Sign up using Google. The ‘try’ is in the wrong place, though. I too was going to give the reference that Bummi gave. I’m afraid I don’t undestand this point. 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.

Post Your Answer Discard By clicking “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy policy and cookie policyand eport your continued use of the website is subject to these policies. Tue, 24 Aug That’s why I use a dbGrid And bummi’s right; if at all possible export the underlying dataset.

So I made it last so that Lista doesn’t leak if dekphi does raise an error.

Reproduced Delphi DBGrid derived Excel method

Next; end; finally Stream. FieldName ; for I: I suggest you start using these, then if you have specific questions about code parts not working, post them here. If you dont have dbgric recordset, you have to iterate your dataset and write excel dvgrid cells. I have the feeling that I’m reinventing the wheel I did this procedure and so far it works fine. There’s hits on a Google search for “delphi export dbgrid excel”.


TObject ; var Stream: FieldCount – 1 do begin S: I need to export the contents of a dbGrid to a CSV file. Quote Sergio Ot wrote: It is working by using Tfilestream component procedure TForm2. In order to use the variant array approach, you have to know how many rows you have in the query.

No, his code takes that into account: TObject ; var Lista: Alexander 3, 6 13 Any help will be appreciated. EnableControls can raise an exception since it causes the screen to update, indirectly. Or directly write to file with AssignFile etc.

All are very good points I would write a generic procedure taking the dbgrid as a parameter and then follow the properties to retrieve header and data.