Page 1 of 1

Justificar Texto Easy Report

PostPosted: Sun Sep 17, 2023 12:40 pm
by leandro
Buenos días para todos

Necesitamos poder justificar un texto largo en EasyReport, pero, aunque hacemos la configuración correcta, no se obtiene el resultado requerido.
Image
Image
Leyendo la clase, pudimos encontrar un método que se encarga de justificar el texto, pero no sabemos como hacer el llamado en el prg
Code: Select all  Expand view

*-- METHOD -------------------------------------------------------------------
*         Name: SayMemoJust
*  Description:
*       Author: Timm Sodtalbers
*-----------------------------------------------------------------------------
METHOD SayMemoJust( nTop, nLeft, nWidth, nHeight, cText, oFont, nColor, nOrient, lVariHeight ) CLASS FW_EReport

   LOCAL i, nSpaces
   LOCAL nTmpHeight     := 0
   LOCAL lMemoPageBreak := .F.
   LOCAL aText          := ::MemoText( cText, nWidth, oFont )
   LOCAL nLines         := LEN( aText )
   LOCAL aAbstand       := ::oPrn:Cmtr2Pix( 0.2, 0.2 )

   FOR i := 1 TO nLines

      aText[i] := RTRIM( aText[i] )
      nSpaces  := ::MemoTextSpaces( aText[i] )

      IF .NOT. EMPTY( aText[i] )
         IF RIGHT( aText[i], 1 ) <> CHR( 127 )
            IF nSpaces > 0 .AND. nOrient = 4
               SETTEXTJUSTIFICATION( ::oPrn:hDCOut, ;
                  nWidth - ::GetTextWidth( aText[i], oFont ), nSpaces )
            ENDIF
         ELSE
            aText[i] = LEFT( aText[i], LEN( aText[i] ) - 1 )
         ENDIF
      ENDIF

      ::Say( nTop, nLeft, aText[i], oFont,, nColor )

      SETTEXTJUSTIFICATION( ::oPrn:hDCOut, 0, 0 )

      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 }
 

Así hacemos el llamado al área de impresión dentro del prg,¿existe otra sintaxis para poder llamar el método SayMemoJust? y que nos imprima el texto justificado.
Code: Select all  Expand view

PRINTAREA 1 OF oVRD ;
ITEMIDS    { 176,177 } ;
ITEMVALUES {  vArt,cTxto}
 


De antemano gracias

Re: Justificar Texto Easy Report

PostPosted: Sun Sep 17, 2023 4:28 pm
by Armando
Leandro:

Si no recuerdo mal, eso lo puedes hacer en los recursos.

Saludos

Re: Justificar Texto Easy Report

PostPosted: Mon Sep 18, 2023 8:25 pm
by leandro
Armando gracias por responder, como vas?

Puedes ser un poco mas especifico porfa :oops: o de casualidad tienes un pequeño ejemplo.

De antemano gracias

Re: Justificar Texto Easy Report

PostPosted: Tue Sep 19, 2023 4:13 am
by Armando
Leandro:

A ver si con estas imágenes puedo apoyarte y sea lo que necesitas.

Image
Así definimos el reporte

Image
Así definimos el control, mira en la imagen la parte donde esta el cursor

Image
Y este es el resultado en la impresión.

Saludos

Re: Justificar Texto Easy Report

PostPosted: Tue Sep 19, 2023 1:42 pm
by leandro
Armando gracias por responder, así como mencionas lo tenemos configurado.

Pero este problema no se si sea un bug de FW, logramos determinar la causa del problema, parece ser que tiene que ver con el tipo de fuente cambie una de las cajas de texto a Arial y funciona correctamente, pero si colocamos Calibri, no hace correctamente la justificación.

Image