FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBrowse: report header and footer
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
XBrowse: report header and footer
Posted: Wed Dec 16, 2020 08:43 AM

Dear friends, I need to make a report from an XBrowse (oBrw:Report()) with an header in the first page and a footer in the last page. Is it possible?

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse: report header and footer
Posted: Wed Dec 16, 2020 02:51 PM

Solved for footer:

oRpt:bPostEnd = { || oRpt:Say( ... ) }

Any ideas for header? I'm trying with oRpt:bInit but it prints after the columns header.

EMG

Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: XBrowse: report header and footer
Posted: Wed Dec 16, 2020 05:17 PM
Enrico.
Try this, please:
Code (fw): Select all Collapse
   ACTIVATE REPORT oReport ;
      ON ENDPAGE ( oReport:oHeader := TrLine():New({}) , oReport:oTitle := TrLine():New({}) , oReport:nTitleRow := 0 )
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse: report header and footer
Posted: Wed Dec 16, 2020 05:43 PM

Thank you. Unfortunately, the page number is overwritten by the double line from the second page on. I tried to reduce the height of the list without results.

EMG

Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: XBrowse: report header and footer
Posted: Wed Dec 16, 2020 06:23 PM
Enrico Maria Giordano wrote:Thank you. Unfortunately, the page number is overwritten by the double line from the second page on. I tried to reduce the height of the list without results.

EMG


Enrico, can you test?
Code (fw): Select all Collapse
//------------------------------------------//
Function TituSoloEnPag1()
local oReport, oFont

   DBUSEAREA(.T.,,"CUSTOMER","CUST",.T.)
   DBGOTOP()

   DEFINE FONT oFont NAME "ARIAL" SIZE 0,-10

   REPORT oReport ;
      TITLE "PROBANDO TITULO-HEADER SOLO EN PRIMERA PAGINA",;
            "UTILIZAMOS 'CUSTOMER.DBF'",;
            "LISTADO DE NUESTROS CLIENTES" ;
      FONT oFont;
      HEADER Dtoc(Date()), "Pag: " + str(oReport:nPage,3) RIGHT ;
      PREVIEW

      COLUMN TITLE "FIRST"  DATA Field->FIRST  SIZE 20
      COLUMN TITLE "LAST"   DATA Field->LAST   SIZE 20
      COLUMN TITLE "STREET" DATA Field->STREET SIZE 30
      COLUMN TITLE "CITY"   DATA Field->CITY   SIZE 20
      COLUMN TITLE "STATE"  DATA Field->STATE  SIZE 10
   ENDREPORT

   ACTIVATE REPORT oReport ;
      ON ENDPAGE ( oReport:oTitle := TrLine():New({}) )

      //Header y Title solo en la primer pagina.
      //ON ENDPAGE ( oReport:oHeader := TrLine():New({}) , oReport:oTitle := TrLine():New({}) , oReport:nTitleRow := 0 )

      //Header y Title en pag 1, y en siguientes header y espacio vacio del title.
      //ON ENDPAGE ( oReport:oTitle := TrLine():New({}) )

      CUST->(DBCLOSEAREA())
      RELEASE oFont

Return nil
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse: report header and footer
Posted: Wed Dec 16, 2020 06:41 PM

Thank you, Francisco. In your sample, the header is printed on the first page, ok, but the header space is left blank from the second page on.

EMG

Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: XBrowse: report header and footer
Posted: Wed Dec 16, 2020 08:02 PM
Enrico Maria Giordano wrote:Thank you, Francisco. In your sample, the header is printed on the first page, ok, but the header space is left blank from the second page on.

EMG


Enrico, here.
Code (fw): Select all Collapse
//------------------------------------------//
Function TituSoloEnPag1()
local oReport, oFont

   DBUSEAREA(.T.,,"CUSTOMER","CUST",.T.)
   DBGOTOP()

   DEFINE FONT oFont NAME "ARIAL" SIZE 0,-10

   REPORT oReport ;
      TITLE "PROBANDO TITULO-HEADER SOLO EN PRIMERA PAGINA",;
            "UTILIZAMOS 'CUSTOMER.DBF'",;
            "LISTADO DE NUESTROS CLIENTES" ;
      FONT oFont;
      HEADER Dtoc(Date()), "Pag: " + str(oReport:nPage,3) RIGHT ;
      PREVIEW

      COLUMN TITLE "FIRST"  DATA Field->FIRST  SIZE 20
      COLUMN TITLE "LAST"   DATA Field->LAST   SIZE 20
      COLUMN TITLE "STREET" DATA Field->STREET SIZE 30
      COLUMN TITLE "CITY"   DATA Field->CITY   SIZE 20
      COLUMN TITLE "STATE"  DATA Field->STATE  SIZE 10
   ENDREPORT

   ACTIVATE REPORT oReport ;
         ON ENDPAGE ( oReport:oTitle := TrLine():New({}), oReport:nTitleRow := oReport:oHeader:nHeight + oReport:nTopMargin )

      CUST->(DBCLOSEAREA())
      RELEASE oFont

Return nil

Regards.
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse: report header and footer
Posted: Wed Dec 16, 2020 08:27 PM

Great! Many thanks, Francisco! :-)

EMG

Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: XBrowse: report header and footer
Posted: Wed Dec 16, 2020 08:35 PM

Nice to collaborate.

Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse: report header and footer
Posted: Wed Dec 30, 2020 03:52 PM
Thank you. Unfortunately, the page number is overwritten by the double line from the second page on. I tried to reduce the height of the list without results.

This is a bug. Happens when oRep:lJoin or oRep:lSeparator is true.
We will fix it soon and inform you.
Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse: report header and footer
Posted: Wed Dec 30, 2020 06:04 PM

Thank you, Master Rao!

EMG

Continue the discussion