export data in listbox to excell linux?

If in window platform use export data in listbox to Excell then
if linux platform ?

** Im use LibreOffice in linux


Save the ListBox data in the appropriate RAW TEXT file.

Add \Tab between Cells and \Return at the end of a Column.

Isn’t it what (-1) already do ?

And this will work on any platform.

If your code does not works (one or two / three lines), show it and I will comment…

I forgot:

“then, with LibreOffice, import the text file as \tab \tab \ return file”

You may also test saving the cells using a comma (,) as the Cell separator + Return as the Row separator and import the RAW TEXT using that file kind. (text csv ?)

In LibreOffice, use the File Type popup menu (from the Open dialog) to choose the file type to import.

Another Way: Export your data as HTML in a file and start your given Spreadsheet Software (Excel on Win, Libre Office on Win/Linux, Numbers on Mac) with that file as switch:

excel.exe yourfilename.html (on Windows)
scalc yourfilename.html (on Mac and Windows)

Use HTML Tags like and

and many others like or to Format your texts.
This might be better than plain CSV Import…

Real better:

Add an Export menu item and place the code below in it.
Eventually change LB with the name of your ListBox
The MenuHandler have to be in the window where your ListBox stands…
Run the project,
execute that menu item,
Save the file
Open that file with LibreOffice and you’re done.

Checked on OS X --> Xojo and LibreOffice.

Ask if something in my code is not crystal clear.

[code] // Export ListBox data into a RAW TEXT file
// Data format in the file: \tab \tab …/… \Return
// Emile Schwarz
// 2013-10-28
// Xojo 2013r3.1
Dim ExportDlg As New SaveAsDialog
Dim ExportFI As FolderItem
Dim ExportTOS As TextOutputStream
Dim RowCnt As Integer
Dim LoopIdx As Integer

#If Not (TargetLinux) Then
ExportDlg.InitialDirectory = SpecialFolder.Documents
#Else //open Home directory on linux
ExportDlg.InitialDirectory = SpecialFolder.Home

ExportDlg.promptText=“Prompt Text”
ExportDlg.SuggestedFileName=“Suggested Filename”
ExportDlg.Title = “Title Property”
ExportDlg.Filter = FT_Text.Text // Defined as a file type in FT_Text file type set
ExportFI = ExportDlg.ShowModal()
If ExportFI = Nil then
// User Cancelled
MsgBox “Did you click in the Cancel button ?”
Return True
End If

// We have a valid RAW TEXT file reference: let’s deal with it !

// Get a TextInputStream OS descriptor
ExportTOS = TextOutputStream.Create(ExportFI)
If ExportTOS = Nil Then
MsgBox “An error occured” + EndOfLine + EndOfLine + "Unable to get an OS text file descriptor "+_
“for the selected file. Choose a different file or check the selected file.”
Return True
End If

// Get the number of Rows
RowCnt = LB.ListCount - 1

// Scan the whole ListBox
For LoopIdx = 0 to RowCnt
// Write one line for each complete Row
ExportTOS.WriteLine LB.Cell(LoopIdx,-1)

// Avoid 1, Infinite Loop
If UserCancelled Then Exit


// Clears the TextOutput reference
ExportTOS = Nil

// Handled (or not)
Return True[/code]

// Clears the TextOutput reference

Read it:

// Clears the TextOutputReference


This might be better than plain CSV Import…
Ouch ! translating raw text into an html file is faster than {read my code above} ?

In how many lines do you translate a text from a ListBox into html (faster than my no line code) ?


ExportTOS.WriteLine LB.Cell(LoopIdx,-1)

is the only line related to the text in ListBox save operation.

I am really curious !

Oh, and in case you really want to save the data to CSV:

OneLine = LB.Cell(LoopIdx,-1) OneLine = ReplaceAll(OneLine,Chr(9),",") ExportTOS.WriteLine OneLine

Nota: I do not checked the above code to save the data as CVS. It may have bug(s).

try http://www.smoothpaygold.com/realbasic/excelwriter.html

There’s a few other options at


Hi, thx for example but when i tried to make it and put that code in action to my export button, it show error and said that method or property doesnt exist: ExportDlg.Filter = FT_Text.Text // Defined as a file type in FT_Text file type set

:frowning: how do icreate that method or property?

@Emile Schwarz you can replace the loop

  // Scan the whole ListBox
  For LoopIdx = 0 to RowCnt
    // Write one line for each complete Row
    ExportTOS.WriteLine LB.Cell(LoopIdx,-1)
    // Avoid 1, Infinite Loop
    If UserCancelled Then Exit


ExportTOS.Write LB.Cell(-1,-1)

i did sir: same msg:
“This method or property doesnt exist”
:frowning: itsso frustrating to get stuck on simple thing 2days…
I Would appreciate if the owner of software will lunch something like lynda.com i will need some videos!!!
…in case you want have new customer coz where i can learn? ok going offline coz im so sad

I think your expectations are too high. I’m a professional programmer and it took me months to become proficient in Xojo, same as any other language I have learned. Slow down and try to understand a little bit at a time. Read the manuals (I know, it’s a pain), look at the examples, work through the Tutorial. Write small simple projects to explore one concept at a time. And walk through everything in the debugger and watch how your variables change.

I think you right in something, but i rather leanr from one video then 100 pages of docs.
And im not alone, if the company have so success why not hire some 3,5 ppl to make lets say 10 vids? It will take time like 2 weeks max and you can make it as a subscription and i will be first who will pay and sub!
:slight_smile: my prob is time i’m old for this and i realize so i’m practicing each time i have left, but it’s normal i need also explication, but no prob i do not force no one to help or explain, thanks anyways for many fast reply its good forum but i go back to vb i think.

There’s a whole series already

:smiley: :smiley: thank you so much sir I go downlaoding all hehehehe i will watch all weekend :stuck_out_tongue: :stuck_out_tongue:
PS: Happy Eastier btw