Export or Print Text from a List View Control

Forms and Controls
Roman Bobik

Version Compatibility: Visual Basic 6

More information:
The Control manages printing and exporting the contents of a ListView in report-mode. It should be placed on a Form, next to a ListView-Control.

It contains two small buttons: Print and Export.

When "Print" is selected, a Option-Dialog is displayed where the user can choose settings like Printer, print in color, print only selected, title, header and footer, etc. After that the contents of the control will be printed on the selected printer.

If the user choosed "Export" he has two options: Export to a textfile or to a Microsoft Excel spreadsheet. In both, a Option-Dialog is displayed, that let you choose the filename and export-layout, etc.

This Control can be used as is, or can be a great introduction to printing, Excel Object Library / VBA, file access and dialog design.

It is well documented and a demo client is included. A german version of the source-code is also included (comments & ui). Note: Printing of the ListView hast been inspired by Marco Losavio with his "Stampa ListView/TreeView"-Classes, but has been widely debugged and improved. Feel free to customize the control and extend it. It would be nice, if you send me an email about it, or if you use it in your applications!

Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download lvexportmanager.zip