Page 1 of 1
How run TextInBox
Posted: Thu May 14, 2020 3:35 pm
by Silvio.Falconi
I'm trying to create a text into a box with printer class
but not run ok
I made
Code: Select all
#include "FiveWin.ch"
function Main()
local oPrn, cText
local oFont
local cmLeft
local cmTexto
PRINTER oPrn PREVIEW
DEFINE FONT oFont NAME "Courier New" SIZE 0, -10 OF oPrn
DEFINE PEN oPen1 STYLE PS_SOLID WIDTH 2 OF oPrn
PAGE
oPrn:TextInBox( 10,5,"Ai sensi dell'art. 10 della legge 675/96 'Tutela delle persone e di altri soggetti rispetto al trattamento dei dati personali'"+CRLF+;
" La informiamo che i dati personali da Lei forniti saranno trattati, nel rispetto degli obblighi di legge",2,2,oFont,oPen1 )
ENDPAGE
ENDPRINTER
oFont:End()
return
but it not create the box and print the text on one line
how do I print a justified text (or rtf file) with printer class ?
Re: How run TextInBox
Posted: Thu May 14, 2020 5:33 pm
by Otto
Silvio,
look into vrd.prg for ::SayMemo or ::SayMemoJust. There you see one way how it can be done.
Code: Select all
METHOD SayMemo( nTop, nLeft, nWidth, nHeight, cText, oFont, nColor, nPad, lVariHeight ) CLASS VRD
LOCAL i
LOCAL nTmpHeight := 0
LOCAL lMemoPageBreak := .F.
LOCAL nLines := MlCount( cText, 240 )
LOCAL aAbstand := ::oPrn:Cmtr2Pix( 0.2, 0.2 )
FOR i := 1 TO nLines
::Say( nTop, nLeft, RTRIM(MemoLine( cText, 240, i )), oFont, nWidth, nColor,, nPad )
nTop += oFont:nHeight + aAbstand[1]
nTmpHeight += oFont:nHeight + aAbstand[1]
IF nTmpHeight > nHeight .AND. lVariHeight = .F.
EXIT
ELSEIF nTop >= ::nPageBreak
//::PageBreak()
//lMemoPageBreak := .T.
//nTop := ::nNextRow
//nTmpHeight := nTop
ENDIF
NEXT
RETURN { nTmpHeight, lMemoPageBreak }
Or make a little ER.
Code: Select all
function multilineText()
local oVRD
local lPreview := .t.
local cDruckerName := ""
local cTITLE := ""
*----------------------------------------------------------
cTITLE := "Ai sensi dell'art. 10 della legge 675/96 'Tutela delle persone e di altri soggetti rispetto al trattamento dei dati personali. La informiamo che i dati personali da Lei forniti saranno trattati, nel rispetto degli obblighi di legge"
TPreview():lListViewHide := .T.
EASYREPORT oVRD NAME ".\xVrd\multilineText.vrd" PREVIEW lPreview TO cDruckerName PRINTDIALOG IIF( lPreview, .F., .F. ) MODAL
PRINTAREA 1 OF oVRD ;
ITEMIDS { 100 } ;
ITEMVALUES { cTITLE }
oVRD:End()
return nil
//----------------------------------------------------------------------------//
Re: How run TextInBox
Posted: Sun May 17, 2020 3:22 pm
by nageswaragunupudi
Please try
Code: Select all
function printtest()
local oPrn, oFont, oBrush, nRow, nCol, nWidth, nLast, nHeight
local cText := "Ai sensi dell'art. 10 della legge 675/96 'Tutela delle persone e di altri soggetti rispetto al trattamento dei dati personali'"+CRLF+;
"La informiamo che i dati personali da Lei forniti saranno trattati, nel rispetto degli obblighi di legge"
PRINT oPrn PREVIEW
DEFINE BRUSH oBrush FILE "c:\fwh\bitmaps\backgrnd\beach.bmp"
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14 BOLD OF oPrn
PAGE
nRow := 5
nCol := 2
nWidth := 10
@ nRow + 0.5, nCol + 0.5 PRINT TO oPrn TEXT cText SIZE nWidth - 1,10 CM FONT oFont ALIGN "TL" LASTROW nLast
oPrn:Box( nRow, nCol, nLast + 0.5, nCol + nWidth, nil, nil, nil, "CM" )
nHeight := nLast - nRow + 1
nRow := nLast + 1
oPrn:Box( nRow, nCol, nRow + nHeight, nCol + nWidth, ;
{ CLR_HRED, 2 }, oBrush, { cText, oFont, CLR_BLUE }, "CM" )
ENDPAGE
ENDPRINT
RELEASE FONT oFont
RELEASE BRUSH oBrush
return nil
Re: How run TextInBox
Posted: Sun May 17, 2020 3:38 pm
by Otto
Dear Mr. Rao,
I used :BOX but you have problems with pagebreak.
Best regards,
Otto
Code: Select all
ELSEIF nTop >= ::nPageBreak
//::PageBreak()
//lMemoPageBreak := .T.
//nTop := ::nNextRow
//nTmpHeight := nTop
ENDIF
Re: How run TextInBox
Posted: Sun May 17, 2020 8:56 pm
by Silvio.Falconi
thanks rao