TPrinter: Recommended way to print zebra line effect

Post Reply
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

TPrinter: Recommended way to print zebra line effect

Post by hua »

What's the recommended way to print with zebra line effect for reports that have many columns?

TIA
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: TPrinter: Recommended way to print zebra line effect

Post by nageswaragunupudi »

Please try

Code: Select all

function PrintZebra

   local oPrn, oFont, oBrushColor, oBrush
   local nRow

   USE STATES

   PRINT oPrn PREVIEW

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12 OF oPrn
   DEFINE BRUSH oBrushColor COLOR CLR_HGRAY

   PAGE

   nRow     := 1.0

   do while STATES->( RECNO() ) < 15 .and. !STATES->( Eof() )

      @ nRow, 1.0 PRINT TO oPrn TEXT STATES->CODE SIZE 1.0, 0.3 INCHES ALIGN "L" FONT oFont COLOR CLR_BLACK, oBrush
      @ nRow, 2.0 PRINT TO oPrn TEXT STATES->NAME SIZE 3.0, 0.3 INCHES ALIGN "L" FONT oFont COLOR CLR_BLACK, oBrush

      nRow     += 0.3
      oBrush   := If( oBrush == nil, oBrushColor, nil )

      STATES->( DbSkip( 1 ) )

   enddo

   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont
   RELEASE BRUSH oBrushColor

return nil
 
Image
Regards

G. N. Rao.
Hyderabad, India
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: TPrinter: Recommended way to print zebra line effect

Post by hua »

Thanks Rao.

However I need it to encompass multi line because I want transactions belonging to the same document are grouped with the same colour

Image
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: TPrinter: Recommended way to print zebra line effect

Post by nageswaragunupudi »

You can.
In the above example, set the oBrush to the brush you want depending on whatever condition you specify.
Regards

G. N. Rao.
Hyderabad, India
Post Reply