How to Print to a File
You can change the windows default printer without calling the
printerdialog function. This can be
done by using Clarion's property syntax. The property to use is
PROPPRINT:Device. This
property definition can be found in the CW15\LIBSRC\PRNPROP.CLW. This
must be included in
your application before making use of any of the properties defined
therein.
This will work for version 1.0 and version 1.5. Please change the fax
retrieval system to reflect the new changes. Much appreciated.
Install the Generic Printer Driver
1. In Windows 3.x, use Control Panel. In Windows 95, choose
Settings
Printers from the Start Menu, then double-click on the Add Printer
icon.
Note:
Version 1.0 does not mention adding a printer device driver name
"Generic / Text Only Printer", however, add one. Additonally, be
sure that the printer port is LPT1.DOS. Refer to your Windows
manual for installing a new printer please.
IMPORTANT:
Set printer port to LPT1.DOS
DO NOT SET THE PRINTER PORT TO LPT1 OR FILE
To include PRNPROP.CLW:
1. Press the Global button on the Application Tree, to open the
Global Properties dialog.
2. Press the Embeds button.
3. Select the 'After Global Includes' embed point and add the
following embedded source code:
include('prnprop.clw')
Note: The path of your PRNPROP.CLW will/should/could differ.
include('c:\cw15\libsrc\prnprop.clw') or
include('c:\cw\libsrc\prnprop.clw')
include('c:\cLlrw\libsrc\prnprop.clw')
include('c:\yourname\libsrc\prnprop.clw')
To change the printer device:
1. From the Application Tree, select your report procedure and
press
the Properties button.
2. Press the Data button. Create a STRING variable named:
sav::printer. Close the Local Data dialog.
In the data section you will see other common variables:
Add yours anywhere you please. Be sure to type it is as follows:
sav::printer
Yes there are two colons, type them as you see them!
3. Press the Embeds button.
4. Select the 'Before Opening Report' embed point and add the
following embedded source code:
Original Code: <This Code Did Not Work For Us, we hope it works
for you because getting the information keyed in the first time
and working makes you feel good about the time you've spent.
sav::printer = PRINTER{PROPPRINT:Device}
! save windows default printer
PRINTER{PROPPRINT:Device} = 'Generic / Text Only'
! set to ASCII device
PRINTER{PROPPRINT:PrintToFile} = TRUE
! print to file flag
PRINTER{PROPPRINT:PrintTo Name} = 'REPORT.TXT'
! set filename for report
We replace the code above with the following:
sav::printer=printer{propprint:device}
printer{propprint:device}='LPT1.DOS'
printer{propprint:printtofile}=TRUE
printer{propprint:printtoname}='REPORT.TXT'
At the end of the report, restore the original default printer:
1. From the Application Tree, select your report procedure and
press
the Properties button.
2. Press the Embeds button.
3. Select the 'After Closing Report' embed point and add the
following embedded source code:
PRINTER{PROPPRINT:Device} = sav::printer
PRINTER{PROPPRINT:PrintToFile} = FALSE ! print to file flag
? 1996 TopSpeed Corporation
Correction Notice:
This is the correction for 'How To Print to a File'. Please refer to
the
Clarion for Windows manuals for additional information. The purpose of
this documentation is to ensure that all who needs this information,
receive the results after two months of searching for an answer.
Because
of the time involved, it is requested that the fax information
retrieval
system be changed.
After experimenting with the printoutput to ASCII, I wanted to see if
I
could create a bulletproof way to export to DISK without changing the
Printer Device Driver. Was there a way? There sure is. Try this
cool
method below and checkout the results. I must warn you that there are
a
few things that I did that may effect you.
1. I'm on a newtwork. My printer is an HP Laserjet 4/m connected
to the network printer.
2. In my control panel, my default printer is the HP Laserjet 4/M
and the Generic Text Driver is presently in the control panel as a
secondary printer assigned to LPT1.DOS.
Remember: My Default Printer Is Set At HP Laserjet 4/M
To change the printer device:
1. From the Application Tree, select your report procedure and
press
the Properties button.
2. Press the Data button. Create a STRING variable named:
sav::printer. Close the Local Data dialog.
In the data section you will see other common variables:
Add yours anywhere you please. Be sure to type it is as follows:
sav::printer
Yes there are two colons, type them as you see them!
3. Press the Embeds button.
4. Select the 'Before Opening Report' embed point and add the
following embedded source code:
Original Code: <This Code Did Not Work For Us, we hope it works
for you because getting the information keyed in the first time
and working makes you feel good about the time you've spent.
!Output To ASCII
!-----------------------------------------------------------------
! Jim's World (714) 597-8111
!-----------------------------------------------------------------
! Using the following code, I was able to create a text file
! using my HP Laserjet 4/M as the default printer device driver
! Additionally, no escape codes (PCLcodes) were generated. The
! Language Reference Guide also, provided some clues for performing
! the task.
!------------------------------------------------------------------
! Should you need additionaly information, sample code and operating
! examples, please call Jim's World at (714) 597-8111 24hrs BBS.
!
!------------------------------------------------------------------
! How It Works
!------------------------------------------------------------------
! The reference manual says, that if you key in 'EPSON' from a list
! of epson device drivers, it will choose the first on the list. So,
! I keyed in Generic, executed the program and watched the output.
! It worked to my satisfaction and all I have to do now is report
! my findings to you.
!
!-------------------------------------------------------------------
sav::printer=printer{propprint:device}
!-------------------------------------------------------------------
! Send Output To LPT1 Communications Port/Fake
!-------------------------------------------------------------------
printer{propprint:device}='Generic'
!-------------------------------------------------------------------
printer{propprint:printtofile}=TRUE
printer{propprint:printtoname}='REPORT.TXT'
Notice: This File Was Created Using Write for Windows. Please download
this file and use write to print. We took advantage of the fonts to
clearly show how we performed various tasks.
Quote:
>Does anyone have any experience exporting data in 2.1 data files to a
>common format for spreadsheets: e.g. ascii, or comma delimeted? An
>Excel filter would be great, but the ascii or CDF would be fine!
>Thanks.
>Regards
>Jonathan Bigwood
>--------------------------:-------------------------------------
>Comunicon Systems Ltd : Voice: +44 (0)1703 262272
>11 Rowlands Close : Fax: +44 (0)1703 262282
>Chandlers Ford, Eastleigh : Compuserve: 100023,3553
>--------------------------:-------------------------------------