ACA VA UN EJEMPLO PARA JUSTIFICAR
cTxt:="ESTA ES LA PRUEBA DE IMPRESION DE UN TEXTO DE LONGITUD VARIABLE "+ ;
"EN FORMA JUSTIFICADA A AMBOS LADOS, PUEDE USARSE CON CUALQUIER " + ;
"TIPO DE TEXTO ESPECIALMENTE CON CAMPOS DE TIPO MEMO."
Imp_MemoW(cTxt,oPrn,3.5,6.5,9.0,oFn1,0.4,CLR_BLUE)
/*
Rutina para imprimir campos memo en forma justificada a
ambos lados.
cTxt - dato tipo memo, en relidad basta con que sea texto
oPrn - objeto TPrinter
nRow - renglon
nCol - columna
nWid - ancho m ximo de texo
oFont - fuente
nSkp - salto o espaciado por renglon
nClr - color
*/
FUNCTION Imp_MemoW(cTxt,oPrn,nRow,nCol,nWid,oFont,nSkp,nClr)
LOCAL cLin, lCont:=.T., nP:=0, lNext, cC, nW
DEFAULT nSkp:=0.4, nClr:=0
cTxt:=Alltrim(cTxt)
nW:=nWid-0.2
nRow-=nSkp
oPrn:Cmtr2Pix(0,@nWid)
DO WHILE lCont // un desmadre para separar
cLin:=cC:="" // y justificar los memos!!
lNext:=.T.
DO WHILE oPrn:GetTextWidth(cLin,oFont)<nWid ;
.AND. nP<=Len(cTxt) .AND. lNext
nP++
cC:=Substr(cTxt,nP,1)
IF Asc(cC)<>13
cLin+=cC
ELSE
nP++
lNext:=.F.
ENDIF
ENDDO
IF Asc(cC)<>13 .AND. Asc(cC)<>0
cC:=Substr(cTxt,nP+1,1)
IF " "$cLin .AND. cC<>" "
DO WHILE cC<>" " .AND. Len(cLin)>0
cLin:=Substr(cLin,1,Len(cLin)-1)
cC:=Right(cLin,1)
nP--
ENDDO
ELSE
cLin:=Substr(cLin,1,Len(cLin)-2)+"-"
cC:=Right(cLin,1)
nP-=2
ENDIF
oPrn:CmSay(nRow+=nSkp,nCol,Alltrim(cLin),oFont,nW,nClr,,3)
ELSE
oPrn:CmSay(nRow+=nSkp,nCol,Alltrim(cLin),oFont,,nClr)
ENDIF
IF nP>=Len(cTxt)
lCont:=.F.
ENDIF
ENDDO
RETURN (Nil)