Page 1 of 1

problem with report

Posted: Thu Jan 22, 2015 11:56 am
by davor0501
The problem with reports for. When printing multiple pages every second, third page is blank. Does anyone encountered a similar problem.
Thank you.

Re: problem with report

Posted: Fri Jan 23, 2015 8:39 am
by Antonio Linares
Davor,

Could you please provide an example to reproduce it here ?

many thanks,

Re: problem with report

Posted: Fri Jan 23, 2015 11:32 am
by davor0501
Antonio,
this is a small example.
I noticed that the problem occurs when I turn in report function cellView ().
Thank you for your help.


// Testing FiveWin built-in report engine and print preview

#include "FiveWin.ch"
#include "Report.ch"

static oWnd, lPreview := .F.

Image

function Main()

local oBar, oCursorHand

DEFINE WINDOW oWnd ;
TITLE "Testing FiveWin Report-Engine and Print-Preview" ;
MENU BuildMenu()

DEFINE BUTTONBAR oBar _3D SIZE 26, 27 OF oWnd

DEFINE BUTTON OF oBar FLAT TOOLTIP "Generate report" ;
ACTION DoReport() RESOURCE "Report"

DEFINE BUTTON OF oBar FLAT GROUP TOOLTIP "Exit" ;
ACTION oWnd:End() RESOURCE "Exit"

DEFINE CURSOR oCursorHand HAND

AEval( oBar:aControls, { | o | o:oCursor := oCursorHand } )

DEFINE MESSAGE BAR OF oWnd TITLE FWCOPYRIGHT ;
NOINSET DATE CLOCK KEYBOARD

ACTIVATE WINDOW oWnd ;
VALID ! lPreview .and. MsgYesNo( "Want to exit ?" )

return nil

function BuildMenu()

local oMenu

MENU oMenu
MENUITEM "&Generate Report" ACTION DoReport() ;
MESSAGE "Open customers database and generate a report"

MENUITEM "&Exit" ACTION oWnd:End() ;
MESSAGE "Terminate the application and exit"
ENDMENU

return oMenu

function DoReport()

local oRpt

lPreview = .T.

USE Customer

REPORT oRpt;
TITLE "Print" ;
HEADER "Report" ;
FOOTER "Page: "+str(oRpt:nPage,3) RIGHT;
PREVIEW
COLUMN TITLE "First" DATA Customer->First
COLUMN TITLE "Last" DATA Customer->Last
COLUMN TITLE "State" DATA Customer->State
END REPORT
oRpt:CellView()
ACTIVATE REPORT oRpt

USE

lPreview = .F.

return nil

Re: problem with report

Posted: Fri Jan 23, 2015 12:13 pm
by karinha

Code: Select all

#include "FiveWin.ch"
#Include "Report.Ch"

STATIC oWnd, lPreview := .F.

function Main()

   local oBar, oCursorHand

   DEFINE CURSOR oCursorHand HAND

   DEFINE WINDOW oWnd ;
          TITLE "Testing FiveWin Report-Engine and Print-Preview" ;
          MENU BuildMenu()

   DEFINE BUTTONBAR oBar _3D SIZE 26, 27 OF oWnd

   AEval( oBar:aControls, { | o | o:oCursor := oCursorHand } )

   DEFINE BUTTON OF oBar FLAT TOOLTIP "Generate report" ;
          ACTION DoReport() RESOURCE "Report"

   DEFINE BUTTON OF oBar FLAT GROUP TOOLTIP "Exit" ;
          ACTION oWnd:End() RESOURCE "Exit"

   DEFINE MESSAGE BAR OF oWnd TITLE FWCOPYRIGHT ;
          NOINSET DATE CLOCK KEYBOARD

   WndCenter( oWnd:hWnd )

   ACTIVATE WINDOW oWnd ;
            VALID ! lPreview .and. MsgYesNo( "Want to exit ?" )

return nil

function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM "&Generate Report" ACTION DoReport() ;
      MESSAGE "Open customers database and generate a report"

   MENUITEM "&Exit" ACTION oWnd:End() ;
      MESSAGE "Terminate the application and exit"

   ENDMENU

return oMenu

function DoReport()

   LOCAL oPen1, oPen2, oFont1, oFont2, oFont3, oRpt

   lPreview = .T.  //??

   USE Customer
   GO TOP

   DEFINE PEN oPen1 WIDTH 2
   DEFINE PEN oPen2 WIDTH 1     

   DEFINE FONT oFont1 NAME "Arial"       SIZE 0, -11
   DEFINE FONT oFont2 NAME "Arial"       SIZE 0, -11
   DEFINE FONT oFont3 NAME "Courier New" SIZE 0,  09 BOLD

   REPORT oRpt TITLE "Print - Report Name"                                   ;
      CAPTION "Report Text Caption"                                          ;
      HEADER "Preview Header - Name Company"                               , ;
      "Date: "   + DTOC( DATE() )                                          , ;
      "Page: "   + STR( oRpt:nPage, 3 )                                      ;
      FOOTER "- Report Text Footer - " CENTER                                ;
      FONT oFont1, oFont2, oFont3                                            ;
      PEN oPen1, oPen2                                                       ;
      PREVIEW

      oRpt:oDevice:lPrvModal := .T.
      oRpt:oDevice:SetPage(9)

      COLUMN TITLE "First" DATA Customer->First

      COLUMN TITLE "Last"  DATA Customer->Last

      COLUMN TITLE "State" DATA Customer->State

   END REPORT

   IF !oRpt:lCreated
      RETURN NIL 
   ENDIF

   oRpt:CellView()

   ACTIVATE REPORT oRpt ON INIT oRpt:oTitle:aFont[1] := { || 3 }

   oPen1:End()  
   oPen2:End()  
   oFont1:End() 
   oFont2:End() 
   oFont3:End()

   USE

   lPreview = .F.

return nil

// END
 
Regards,

Re: problem with report

Posted: Fri Jan 23, 2015 12:29 pm
by davor0501
Mr. Karinha thanks for your help, now everything works ok.
Regards Davor.

Re: problem with report

Posted: Fri Jan 23, 2015 1:04 pm
by karinha
Congratulations.

I was happy now.

Regards,