Exporting the ListBox Contents 2021r2.1

At woke up time, I add an Export to Text feature to a window with a ListBox and failed miserably, then I go back to bed for an hour (or two)…

Is it possible to do that ?

This is not for this morning project (I do that from the Data stored in .sqlite file)… but because I have a File Manager project where I use the ListBox as a data holder and save the data to disk on demand, never live.

PS (Edit): I do not talked about the comparative length of code old API vs API2… I do not even know (not tested) if it works with a file that have two TABLEs… to save data from…

I know it may sound strange, but I have a Method that turns my ListBox (Desktop, Web or Mobile Table) into a RowSet (the reason I use a RowSet is that it works cross-environment and with the results of a database query). Then I have another Method that turns a RowSet into any of:

  1. CSV (easy using TextOutputStream)
  2. XLSX (using Einhugur ExcelWriterWorkbook)
  3. Tab-delimited (easy using TextOutputStream)
  4. PDF (using wkHTML2PDF)

I give the user the option to Open the Exported file (FolderItem chosen for them) or Save As… the Exported file (they choose the FolderItem).

I can also export to XML (using ExcelExporterWorkbook) or SQL INSERT statements, but that’s for a specialised app.

API2 ?

In old API, I have an application sincve 2013 that is able to print (Color -background- + Black and white), Save as PDF, Export as JSON, csv, raw txt, xml,… and split the data base (by years: save all entries until year XXXX in an archive database and remove these entries from the current db).

Back to my original question, it tooks me 100 lines of code (and comments) to achieve the goal with API2 (reading the data from the .sqlite file) vs some lines:


Write_TOS.WriteLine LB.Row(-1,-1)

If I recall correctly… (to get what I wanted to do this morning: simple \tab \cr in a raw text file).