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):||19 June 2018|
|PDF File Size:||15.14 Mb|
|ePub File Size:||17.96 Mb|
|Price:||Free* [*Free Regsitration Required]|
I would write a generic procedure taking the dbgrid as a parameter and then follow the properties to retrieve header and data.
: export a TDBGrid to excel without OLE?
FieldCount – 1 do begin sTemp: FieldName ; end; s: FieldCount – 1 exporr begin S: Mon, 23 Aug No, his code takes that into account: Do not export the DBGrid, export the dataset stackoverflow. 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.
It is working by using Tfilestream component procedure TForm2. Any help will be appreciated.
FieldCount – 1 do begin s: Okay I will go have a look at that. As the DBGrid might have a different set of fields then the original resultset you need to access these. TObject ; var Lista: I too was going to give the reference that Bummi gave. The ‘try’ is in the wrong place, though.
Export contents of DBGrid to Excel or ClipBoard
If you want a fast export of raw data, just export your recordset ADODataset. Paul Scot Delphi Developer. No’amNewman depending on the datataypes the csv approach might give more trouble in convertions e. TObject ; var Stream: Sign up using Facebook.
Sun, 29 Aug In order to use the variant array approach, you have to know dbrgid many rows you have in the query. All are very good points Or directly write to file with AssignFile etc. Sergio Gonzale Delphi Developer. Otherwise it may be simpler to use the csv approach which I gave in that question.
I suggest you start using these, then if you have specific questions about code parts not working, post them here. I’m afraid I don’t undestand this point.
Reproduced Delphi DBGrid derived Excel method