Now, reviewing the issue of compatibility of the behavior of the method Say() when nWidth parameter is nil and nPad is Right/Center.
This program shows the difference in the behaviour.
Code: Select all
#include "fivewin.ch"
#include "report.ch"
REQUEST FWHARU
function Main()
local oPrn, oFont, oPen, nWidth
local cPdfFile
TPrinter():lUseHaruPDF := .t.
if MsgYesNo( "Output to PDF?" )
cPdfFile := "test.pdf"
endif
PRINT oPrn PREVIEW FILE cPdfFile
DEFINE FONT oFont NAME "ARIAL" SIZE 0,-14 BOLD OF oPrn
DEFINE PEN oPen WIDTH 1 OF oPrn
PAGE
nWidth := 14
oPrn:Say( 1, 3, If( cPdfFile == nil, "TPrinter", "FWPdf" ), oFont, nil, nil, nil, 0, "CM" )
oPrn:Say( 2, 3, "Method Say() with nWidth param = 14 cm", oFont, nil, nil, nil, 0, "CM" )
oPrn:RoundBox( 3, 3, 7, 17, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
oPrn:Say( 4, 3, "LEFT ALIGNED TEXT WIDTH 14 CM", oFont, nWidth, nil, nil, 0, "CM" )
oPrn:Say( 5, 3, "RIGHT ALIGNED TEXT WIDTH 14 CM", oFont, nWidth, nil, nil, 1, "CM" )
oPrn:Say( 6, 3, "CENTERED TEXT WIDTH 14 CM", oFont, nWidth, nil, nil, 2, "CM" )
nWidth := nil
oPrn:Say( 8, 3, "Method Say() with nWidth param = nil" + ;
If( cPdfFile == nil, "", " : FWPdf ignores Alignment" ), oFont, nil, nil, nil, 0, "CM" )
oPrn:RoundBox( 9, 3, 13, 17, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
oPrn:Say( 10, 3, "LEFT ALIGNED TEXT WIDTH NIL", oFont, nWidth, nil, nil, 0, "CM" )
oPrn:Say( 11, 3, "RIGHT ALIGNED TEXT WIDTH NIL", oFont, nWidth, nil, nil, 1, "CM" )
oPrn:Say( 12, 3, "CENTERED TEXT WIDTH NIL", oFont, nWidth, nil, nil, 2, "CM" )
if cPdfFile == nil
oPrn:Say( 15, 3, "LEFT Align: Prints text to the RIGHT of nCol", oFont, nil, nil, nil, 0, "CM" )
oPrn:Say( 16, 3, "RIGHT Align: Prints text to the LEFT of nCol", oFont, nil, nil, nil, 0, "CM" )
oPrn:Say( 17, 3, "CENTER Align: Prints text CENTERED around nCol", oFont, nil, nil, nil, 0, "CM" )
endif
oPrn:RoundBox( 18, 3, 22, 17, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
oPrn:Say( 19, 3, "LEFT", oFont, nWidth, nil, nil, 0, "CM" )
oPrn:Say( 20, 3, "RIGHT", oFont, nWidth, nil, nil, 1, "CM" )
oPrn:Say( 21, 3, "CENTER", oFont, nWidth, nil, nil, 2, "CM" )
ENDPAGE
ENDPRINT
RELEASE FONT oFont
RELEASE PEN oPen
return nil