Most of the users of my app use DOT Matrix printers connected to their local LPT port and few of them are using network printers (DOT Matrix) mapped to their local LPT port (Net use LPT1 \\PcName\PrintShareName)
For printing they use computer paper stationaries with size 10x12 inch or 10*15" inch papers and not A4.
My application create reports on a text file and once the report is created on a text file, I give choice to user either to
1) View the report on screen (using a Text file browser)
2) Print the report ( If this opted then the already created text file is copied to the LPT port using the command copy file xxx.txt to LPT1, which prints the report in a much faster way unlike printing from windows in graphics mode)
3) Save the report (Txt) in a user specified folder for future reference.
I use to write my clipper app using the following method
- Code: Select all Expand view
Set Printer to "Report.Txt"
Set Device to Printer
SetPrc(00,00)
Set Console Off
Use Account Index Account
@prow()+1,00 say "Company Name"
@prow()+1,00 say Padc("Account Heads",80)
@prow()+1,00 say "/---------------------------------------------\"
@prow()+1,00 say "| Ac Head | Op.Balance |"
@prow()+1,00 say "|-----------------------------|---------------|"
Sele Account
Go Top
Do while !eof()
If prow() > 65
@prow()+1,00 say "\-------------------------------------/"
EJECT
@prow()+1,00 say "Company Name"
@prow()+1,00 say Padc("Account Heads",80)
@prow()+1,00 say "/---------------------------------------------\"
@prow()+1,00 say "| Ac Head | Op.Balance |"
@prow()+1,00 say "|-----------------------------|---------------|"
Endif
@prow()+1,00 say "| "+AC_NAME+" | "+str(OP_BALANCE,9,2)+" |"
Sele AcMaster
Skip
Enddo
@prow()+1,00 say "\-------------------------------------/"
@prow()+100 say "End of Report"
SetPrc(00,00)
Set Printer to
Set Device to Screen
Set Console On
RptOptions() // This function gives the choice to the user either to view or print or to save the text file for future ref.
Trying to accomplish similiar task using FWH I wrote code in FWH as given below.
I know that the method used by me is very old and FWH will have much more powerful techniques which can be done in a much better way.
I need your view on this, keeping in mind the following
1) an option for the user to either dump to LPT port for those who need fast printing.
2) Preview of the report
2) Save the report in Text format, excel etc.
How can the same be accomplished using FWH in a much better way.
I also noticed that Prev32.Dll should be there for the Report preview to work.
As a beginner I tried to create a report using FWH, I don't know whether this is the right way or not.
The font is appearing too small. I don't know what is thosr parameters 0,-12 while defining font Define Font oFont "Font Name " Size 0, 13
My FWH code
- Code: Select all Expand view
*---------------------------------------------------*
Function AcPrn()
*---------------------------------------------------*
local oPrn, oFont, oPen
Local nRowStep, nColStep
Local nRecNo
Local nRow := 0, nCol := 0
Sele AcMaster_ACM
nRecNo:=RecNo()
PRINT oPrn NAME "Account Heads" PREVIEW
if Empty( oPrn:hDC )
MsgStop("No printers Installed")
Return nil // Printer was not installed or ready
endif
DEFINE FONT oFont NAME "Courier New" SIZE 0, -12
* DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -12 OF oPrn
* DEFINE FONT oFont NAME "Arial" SIZE 0, -10 BOLD OF oPrn
nRowStep = oPrn:nVertRes() / 65 // We want 65 rows
nColStep = oPrn:nHorzRes() / 80 // We want 80 cols
* DEFINE PEN oPen WIDTH 2 OF oPrn
oPrn:SetPage(9) // A4
oPrn:SetPortrait() //Vertical
PAGE
nRow:=0; nCol:=0
oPrn:Say(nRow,nCol,"/-------------------------------\",oFont)
nRow += nRowStep
nCol:=0
oPrn:Say(nRow,nCol,"| AcName |",oFont)
nRow += nRowStep
nCol:=0
oPrn:Say(nRow,nCol,"|-------------------------------|",oFont)
nRow += nRowStep
Sele AcMaster_ACM
Go Top
Do While !eof()
if nRow > oPrn:nVertRes() -5
nCol:=0
oPrn:Say(nRow,nCol,"\-------------------------------/",oFont)
ENDPAGE
PAGE
nRow:=0; nCol:=0
oPrn:Say(nRow,nCol,"/-------------------------------\",oFont)
nRow += nRowStep
nCol:=0
oPrn:Say(nRow,nCol,"| AcName |",oFont)
nRow += nRowStep
nCol:=0
oPrn:Say(nRow,nCol,"|-------------------------------|",oFont)
nRow += nRowStep
Endif
nCol:=0
oPrn:Say(nRow,nCol,"| "+NAME+" |",oFont)
nRow += nRowStep
Select AcMaster_ACM
Skip
Enddo
ENDPAGE
ENDPRINT
oFont:End() // Destroy the font object
Sele AcMaster_ACM
Goto nRecNo
Return nil
Any help will be appreciated
Regards
Anser