FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Reporte con Doble Renglon
Posts: 257
Joined: Mon Jun 10, 2013 06:40 PM
Reporte con Doble Renglon
Posted: Sat Oct 10, 2020 05:56 PM
Hola, buenas tardes a Todos
Estoy tratando de hacer un Reporte (array) que depende de la longitud del nombre
pueda hacer doble renglon.

Code (fw): Select all Collapse
            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.
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Reporte con Doble Renglon
Posted: Sat Oct 10, 2020 07:13 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Reporte con Doble Renglon
Posted: Sat Oct 10, 2020 11:45 PM

Javier:

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

Saludos

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 257
Joined: Mon Jun 10, 2013 06:40 PM
Re: Reporte con Doble Renglon
Posted: Mon Oct 12, 2020 04:27 PM

Gracias por su tiempo

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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Reporte con Doble Renglon
Posted: Sun Nov 01, 2020 01:45 AM
Report class automatically breaks long text near spaces and prints multiline text.

Code (fw): Select all Collapse
#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


Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Reporte con Doble Renglon
Posted: Sun Nov 01, 2020 07:53 AM
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 )
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion