Back

PowerBuilder - Source Code

- Printing a datawindow to a text file


Step 1 :

Install "Generic / Text Only" printer driver on your PC.

Step 2 :

// save original Printer settings.
ls_orgprinter = Profilestring("c:\windows\win.ini","windows","device","")

Step 3 :

// Change printer to 'Generic / Text Only'
Setprofilestring("c:\windows\win.ini", "windows", "device", "Generic / Text Only,TTY,LPT1:")

Step 4 :

// Select 'Print to File' option in printer setting & print
dw_1.object.DataWindow.Print.filename = 'c:\temp\test.txt'
dw_1.print()

Step 5

// Set back original printer settings.
Setprofilestring("c:\windows\win.ini", "windows", "device", ls_orgprinter):

I copied these instructions from Jitendra P. Jilka's posting to the PFC - SIG.


Back