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):||26 February 2006|
|PDF File Size:||4.68 Mb|
|ePub File Size:||7.44 Mb|
|Price:||Free* [*Free Regsitration Required]|
I’m afraid I don’t undestand this point. Otherwise it may be simpler to use the csv approach which I gave in that question.
And if We want export an ClientDataset to Excel then what exoprt do? FieldCount – 1 do begin sTemp: Do not export the DBGrid, export the dataset stackoverflow. I suggest you start using these, then if you have specific questions about code parts not working, post them here.
All are very good points There’s hits depphi a Google search for “delphi export dbgrid excel”. Next; end; finally Stream. Tue, 24 Aug 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. I have the feeling that I’m reinventing the wheel That’s why I use a dbGrid TObject ; var Lista: I too was going to give the reference that Bummi gave.
Export contents of DBGrid to Excel or ClipBoard
No’amNewman depending on the datataypes the csv approach might dxport more trouble in convertions e. I will save it for future use.
Any help will be appreciated.
FieldCount – 1 do begin S: Exporting can be done this way, but you can also use tstringlist. Sun, 29 Aug No, his code takes that into account: It is working by using Tfilestream component procedure TForm2.
How to export data in DBGrid to excel – Delphi Pages Forums
Reproduced Delphi DBGrid derived Excel method
Sign up or log in Sign up using Google. The ‘try’ is in the wrong place, though. FieldName ; for I: And bummi’s right; if at all possible export the underlying dataset. In order to use the variant array approach, you have to know how many rows you have in the query.
Okay I will go have a look at that. Quote Sergio Gonzalez wrote: I need to export the contents of a dbGrid to a CSV file.
: export a TDBGrid to excel without OLE?
So I made it last so that Lista doesn’t leak if it does raise an error. FieldName ; end; s: I would write a generic procedure taking the dbgrid as a parameter and then follow the properties to retrieve header and data.
Or directly write to file with AssignFile etc. CSV File Access