Page 1 of 1

Reporte con Doble Renglon

PostPosted: Sat Oct 10, 2020 5:56 pm
by VitalJavier
Hola, buenas tardes a Todos
Estoy tratando de hacer un Reporte (array) que depende de la longitud del nombre
pueda hacer doble renglon.

Code: Select all  Expand view

            Column Title "","Cant"                  Data aDatDetalle[nRegis,1] SIZE 8  FONT 2  Picture "9999.99"  
            Column Title "","Unid"                  Data aDatDetalle[nRegis,2] SIZE 4  FONT 2  
                       
            IF Len(AllTrim(aDatDetalle[nRegis,3])) > 35
                _ccCadena1 := AllTrim(aDatDetalle[nRegis,3])
                _ccCadena2 := ""
               ******************************** Aqui trato que el corte del Renglon sea cuando encuentro un Espacio " "
                FOR I := 35 TO 1 STEP -1
                    IF SUBSTR(_ccCadena1,I,1) = " "
                            Column Title "Nombre"               Data SubStr(aDatDetalle[nRegis,3],1,I) SIZE 35  FONT 2
                            _ccCadena2 := SubStr(aDatDetalle[nRegis,3],I+1)
                        EXIT
                    ENDIF
                NEXT               
                Imprime2Renglon(_ccCadena2,oReporte)    // Aqui imprimo en el siguiente renglon el resto de la cadena
            ELSE
                    Column Title "","Nombre"                Data aDatDetalle[nRegis,3] SIZE 35  FONT 2
            ENDIF

 


Pero no lo hace
Si alguien pudiera echarme la mano
De antemano, muchisimas gracias.

Re: Reporte con Doble Renglon

PostPosted: Sat Oct 10, 2020 7:13 pm
by karinha

Re: Reporte con Doble Renglon

PostPosted: Sat Oct 10, 2020 11:45 pm
by Armando
Javier:

Creo que lo vas a tener que hacer "a pie".

Saludos

Re: Reporte con Doble Renglon

PostPosted: Mon Oct 12, 2020 4:27 pm
by VitalJavier
Gracias por su tiempo

Armando, pues si me la avente "a pie" y ya quedo

Re: Reporte con Doble Renglon

PostPosted: Sun Nov 01, 2020 1:45 am
by nageswaragunupudi
Report class automatically breaks long text near spaces and prints multiline text.

Code: Select all  Expand view
#include "fivewin.ch"
#include "report.ch"

function Main()

   local aData := { { "First Row",  "This is a sentence" }, ;
                    { "Second Row", "This is even a longer sentence and does not fit into one line" }, ;
                    { "ThirdRow",   "Short text" } }

   local nAt   := 1
   local oRep, oFont

   DEFINE FONT oFont NAME "ARIAL" SIZE 0,-12
   REPORT oRep PREVIEW

   COLUMN TITLE "NAME"    DATA aData[ nAt, 1 ] SIZE 15
   COLUMN TITLE "DETAILS" DATA aData[ nAt, 2 ] SIZE 30 MEMO

   oRep:bSkip  := { || nAt++ }

   ENDREPORT

   ACTIVATE REPORT oRep WHILE ( nAt <= Len( aData ) )

   RELEASE FONT oFont

return nil


Image

Re: Reporte con Doble Renglon

PostPosted: Sun Nov 01, 2020 7:53 am
by nageswaragunupudi
FOR I := 35 TO 1 STEP -1
IF SUBSTR(_ccCadena1,I,1) = " "
Column Title "Nombre" Data SubStr(aDatDetalle[nRegis,3],1,I) SIZE 35 FONT 2
_ccCadena2 := SubStr(aDatDetalle[nRegis,3],I+1)
EXIT
ENDIF
NEXT


It is much easier to use MLCount() and MemoLine()

nLines := MLCount( cText, nLen )
cLine1 := MemoLine( cText, nLen, 1 )
cLine2 := MemoLine( cText, nLen, 2 )