Page 1 of 1

Como Justificar completo impresion campo memo

Posted: Sat Jun 14, 2014 3:58 am
by gabrieloq
Hola a todos, les agradeceria si me pueden ayudar necesito imprimir varios campos memos pero el problema es que deben justificarse tanto a la izquierda como a la derecha.
asi lo estoy haciendo pero sin justificar

cVar := strtran( Formulas->Detalle, ";", ' ')

if len( cVar ) > 0
nLinx := MLCOUNT( cVar, 130 )
for nLin := 1 to nLinx
cImpr := MEMOLINE( cVar, 130, nLin )
nLinea += 3
@ nLinea, 12 PRINT cImpr FONT "Arial" SIZE 7
next
nLinea += 8
endif

Como Justificar completo impresion campo memo

Posted: Sat Jun 14, 2014 2:11 pm
by Pablo César
Hola Gabriel,

Para conseguir un resultado más rápido y menos dificil. Debes utilizar fuentes monospace, es decir fuentes que tengan el mismo tamaño en cada caracter.

Si te fijas en el código del STRU, en la funcion MyAlert verás otros llamados que arreglan el texto: FixText y Split. Fijate si te sirve, pero tienen que ser en "Courier New", ok ?

Re: Como Justificar completo impresion campo memo

Posted: Sat Jun 14, 2014 2:42 pm
by Jairo Maia
(Bing translator)
Hola Gabriel,

Ver si eso también te da una idea:

Code: Select all

cVar := StrTran( Formulas->Detalle, ";", ' ')

If Len( cVar ) > 0
 nLinx := MlCount( cVar, 130 )
 For nLin := 1 to nLinx
  cImpr := MemoLine( cVar, 130, nLin )
  cImpr := JustMemo( cImpr )
  nLinea += 3
  @ nLinea, 12 PRINT cImpr FONT "Arial" SIZE 7 
 Next 
 nLinea += 8 
EndIf

Function JustMemo( cLine )
 Local cSpace := Space( 1 )
 Local nLenLine := Len( cLine )

 If Right( Trim( cLine ), 1 ) != "." .And. At( " ", Trim( cLine ) ) > 0

  cLine := Trim( cLine )

  While ( nLenLine - Len( cLine ) > 0 )
   nRepeat := ( nLenLine - Len( cLine ) )
   If ( nRepeat > 0 )
    cLine := StrTran( cLine, cSpace, cSpace + cSpace, 1, nRepeat )
   EndIf
  EndDo

 EndIf

Return cLine

Como Justificar completo impresion campo memo

Posted: Sat Jun 14, 2014 9:21 pm
by gabrieloq
Gracias Jairo era lo que estaba necesitando, le agradezco su colaboracion eres un mago.