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.
|Published (Last):||15 January 2009|
|PDF File Size:||7.85 Mb|
|ePub File Size:||16.83 Mb|
|Price:||Free* [*Free Regsitration Required]|
FieldCount – 1 do begin s: CSV from a text file into a record structure 7.
FieldName ; end; s: Sign up or log in Sign up using Google. Agustin Seifert 1, 12 No, his code takes that into account: Okay I will go have a look at that. dbgrir
Post as a guest Name. Sergio Gonzale Delphi Developer. It is working by exporrt Tfilestream component procedure TForm2.
Thanks for the procedure! That’s why I use a dbGrid FieldCount – 1 do begin sTemp: I’m afraid I don’t undestand this point. So I made it last so that Lista doesn’t leak if it does raise an error.
I would write a generic procedure taking the dbgrid as a parameter and dbgrod follow the properties to retrieve header and data. I did this procedure and so far it works fine.
In order to use the variant array approach, you have to know how many rows you have in the query. CSV File Access Rich Wernin Delphi Developer. EnableControls can raise an exception since it causes the screen to delpyi, indirectly. Otherwise it may be simpler to use the csv approach which I gave in that question. No’amNewman depending on the datataypes the csv approach might give more trouble in convertions e.
Paul Scot Delphi Developer.
The ‘try’ is in the wrong place, though. Sun, 29 Aug There’s hits on a Google search for “delphi export dbgrid excel”.
Next; end; finally Stream. I need to export the contents of a dbGrid to a CSV file. FieldCount – 1 do begin S: All are very good points TObject ; var Lista: If you dont have dwlphi recordset, you have to iterate your dataset and write excel accesing cells. Sign delphk using Email and Password. Quote Sergio Gonzalez wrote: Exporting can be done this way, but you can also use tstringlist.
Any help will be appreciated. Mon, 23 Aug Do not export the DBGrid, export the dataset stackoverflow.
Alexander 3, 6 13 I too was going to give the reference that Bummi gave. I suggest you start using these, then if you have specific questions about code parts not working, post them here.