Printing from Listbox

Have a Listbox with 6 columns in and all I want to do is print out the whole lot to printer.
Have looked at the new help but finding it unhelpful as all it tell you is how to print to a listbox or such.
Any help would be appreciated.

There is no automated way.

You got to print the content of the listbox to the g graphics property of the printing process.

Basically, g represents the page. You print the content of a column by reading each cell, and increment Y.

Then you do the same with an X value to push printing after the first column.

And so on until you get to 6th column.

You may want to draw lines to separate columns.

I do that in one of my apps.

1 Like

Check out Examples->Printing & Reporting->Reporting->ListboxReport.


Hi, thanks for your comments and have managed to sort out a method but is cheap and nasty but works ,sending the lines of text to the printer and letting the printer deal with new pages.

This only done as this program is for my use only and would never use this method for anything else.


Have now sorted the problem and prints each page nicely but have a problem with finding
the number of lines on a page have tried using the Height and dividing by the font size but seems the
height is in a different measurement than the font height.

Thanks anyway.

you must also subtract the footer and header height from the page size.
and also use graphics.textheight instead of textsize to get the real height of the drawn string

Thank you Jean-Yves have done as you suggest and now fills page with text and works fine on my print
and ask a friend to try it and works fine on his printer (different Model ).

Thank You again…