0

I'm working on Delphi 2010 and I'm making some reports with data retrieved from some tables in a Oracle DB, I'm using the ExportGridToExcel function, it works well, but actually I'm manipulating between 40k to 800k records, that's turning the operation so slow on the DBGRID, I would like to know if there is another option to export (CSV and XLS) those records from Delphi, i.e. directly from the Dataset (not using a DBGRID). Any suggestions? thank you!

BaldwinIV
  • 147
  • 10
  • That sounds like the Developer Express grid not the stock grid. They have improved the export speed of the cxGrid on occasion so updating to a latter release might help. – Brian Oct 15 '19 at 13:32
  • Are you creating a program just to export data from database to Excel? Do you know that Excel can conect to various databases in order to import data from database to Excel Workbook? – SilverWarior Oct 15 '19 at 13:45
  • 1
    Hi SilverWarrior, no, this program has a lot of functionalities (Kind of an enterprise software), it's kinda complex to be honest, I'm just focusing on the fact that I have to let the Final User export his data to excel and CSV from a lot of records he can access to. – BaldwinIV Oct 15 '19 at 13:57
  • If it is the Developer Express cxGrid it also can do sorting, filtering, column hiding/re-ordering and more client side which will be reflected in what is exported to an Excel or CSV file. Going straight from the TDataSet will lose all that which may or may not be an issue. – Brian Oct 15 '19 at 14:11
  • Hi Brian, yes I'm using Developer Express, can you be more specific or provide me some documentation about exporting to CSV via Delphi 2010? thank you so much – BaldwinIV Oct 15 '19 at 15:37
  • @Baldwin: Check this https://www.devexpress.com/Support/Center/Question/Details/T470334/export-dbgrid-data-to-csv-file-in-utf8-format – Schneider Infosystems Ltd Oct 15 '19 at 16:40
  • There is Delphi code that writes directly to ods, excel xml, xlsx on GitHub. It shortened a +21:00 minute DX export of the same data to 1:42. – FredS Oct 15 '19 at 18:18
  • Thank you for your repplies, @ Schneider Infosystems Ltd I'll see that, thank you. @FredS can you give me any clue about how to find that code? – BaldwinIV Oct 15 '19 at 19:34
  • [Github Search](https://github.com/search?q=delphi+write+ods%2C+excel+xml%2C+xlsx) – FredS Oct 15 '19 at 21:02
  • 1
    Imo you are approaching this the wrong way: forget the grid, what you should be doing is exporting the data from the dataset which supplies the grid's data. Google how to do that. Some grids, like the cxGrid do a good job of exporting data in a WYSIWYG (remember that???) fashion, but it's better to know how to get the result you want without relying on the grid to do it for you. – MartynA Oct 15 '19 at 22:25
  • Exporting data should have absolutely nothing to do with a DBGrid. A DBGrid is a display (user interface) component,that simply displays the underlying data to a user. It has no business being involved in anything else but the user interface, and if you're involving it in something else then you're doing it the wrong way. – Ken White Oct 15 '19 at 22:52
  • A place to start would be https://stackoverflow.com/a/5680190/62576 – Ken White Oct 15 '19 at 23:13
  • @KenWhite the more advanced grids do more than just display the data - they provide sorting, filtering, selection of rows/columns etc to the point of being close enough to a light weight end user query tool that as MartynA mentions they are a decent WYSIWYG export tool to Excel. If the users are making use of that part of the export and not just dumping all the data to CSV then export tools that go straight from the source may not be suitable without duplicating all the extra functionality of the grid for filtering etc. – Brian Oct 15 '19 at 23:39

0 Answers0