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: Zujinn Faugor
Country: Armenia
Language: English (Spanish)
Genre: Marketing
Published (Last): 12 July 2011
Pages: 81
PDF File Size: 4.81 Mb
ePub File Size: 6.20 Mb
ISBN: 674-3-13077-118-6
Downloads: 53790
Price: Free* [*Free Regsitration Required]
Uploader: Vulkis

Rich Wernin Delphi Developer.

Export contents of DBGrid to Excel or ClipBoard

CSV File Access TObject ; var Stream: I’m just curious if that’s the best way to do it Tue, 24 Aug I need to export the contents of a dbGrid to a CSV file. Sign up using Facebook.

Mon, 23 Aug Exporting can be done this way, but you can also use tstringlist. That’s why I use a dbGrid In order to use the variant array approach, you have to know how many rows you have in the query.

Reproduced Delphi DBGrid derived Excel method

And if We want export an ClientDataset to Excel then what we do? FieldCount – 1 do begin sTemp: Sign up or log in Sign up using Google. Post as a guest Name. Stack Overflow works best with JavaScript enabled. The delph is in the wrong place, though. FieldName ; end; s: 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 ex;ort a parameter and then follow the properties to retrieve header and data. Thanks for the procedure! FieldCount – 1 do begin S: TObject ; var Lista: Sign up using Email and Password.

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. Alexander 3, 6 13 By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.

Do not export the DBGrid, export the dataset stackoverflow. There’s hits on a Dbgrkd search for “delphi export dbgrid excel”. Sergio Gonzale Delphi Developer. 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.

Next; end; finally Stream.

Agustin Seifert 1, 12 Post Your Answer Discard By clicking “Post Your Answer”, you acknowledge rxport you have read our updated terms of serviceprivacy policy and cookie policyand that your continued use of the website is subject to these policies. Otherwise it may be simpler to use the csv approach which I gave in that question.


Any help will be appreciated. FieldCount – 1 esport begin s: Sun, 29 Aug Quote Sergio Gonzalez wrote: I will save it for future use.

It is working by using Tfilestream component procedure TForm2. EnableControls can raise an exception since it causes the screen to update, indirectly. I did this procedure and so far it works fine. FieldName ; for I: I too was going to give the reference that Bummi gave.

How to export data in DBGrid to excel – Delphi Pages Forums

Or directly write to file with AssignFile etc. I’m afraid I don’t undestand this point.

Email Required, but never shown.