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):||11 March 2010|
|PDF File Size:||18.54 Mb|
|ePub File Size:||1.5 Mb|
|Price:||Free* [*Free Regsitration Required]|
Email Required, but never shown.
Export contents of DBGrid to Excel or ClipBoard
There’s hits on a Google search for “delphi export dbgrid excel”. Agustin Seifert 1, 12 Sign up using Email and Password. Okay I will go have a look at that. I need to export the contents of a dbGrid to a CSV file. That’s why I use a dbGrid Alexander 3, 6 13 The ‘try’ is in the wrong place, though.
: export a TDBGrid to excel without OLE?
FieldCount – 1 do begin sTemp: I did this procedure and so far it works fine.
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. In order to use the variant array approach, you have to know exlort many rows you have in the query. I suggest you start using these, then if you have specific questions about code parts not working, post them here.
Export contents of DBGrid to Excel or ClipBoard – Delphi Tips – CJC Delphi (Cool Delphi Tips)
FieldName ; end; s: I’m afraid I don’t undestand this point. Dbgfid depending on the datataypes the csv approach might give more trouble in convertions e. I too was going to give the reference that Bummi gave. I’m just curious if that’s the best way to do it Mon, 23 Aug Exporting can be done this way, but you can also use tstringlist.
TObject ; var Lista: FieldCount – 1 do begin S: TObject ; var Stream: Sergio Gonzale Delphi Developer. Quote Sergio Gonzalez wrote: I have the feeling that I’m reinventing the wheel Do not export the DBGrid, export the dataset stackoverflow.
FieldName ; for I: If you dont have a recordset, you have to iterate your dataset and write excel accesing cells. Rich Wernin Delphi Developer. CSV File Access If you want a fast export of raw data, just export your recordset ADODataset.
Next; end; finally Stream. Or directly write to file with AssignFile etc. Sun, 29 Aug Any help will be appreciated.
Sign up or log in Sign up using Google. Sign up using Facebook.
Paul Scot Delphi Developer. FieldCount – 1 do begin s: All are very good points So I made it last so that Lista doesn’t leak if it does raise an error. EnableControls can raise an exception since it causes the screen to update, indirectly.