Page 1 of 2

set Report Orientation

PostPosted: Sun Jan 02, 2022 10:05 pm
by Silvio.Falconi
.

Re: set Report Orientation

PostPosted: Mon Jan 03, 2022 1:09 am
by karinha
Maybe:

Code: Select all  Expand view

// \samples\RPTLINHA.PRG

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

STATIC oReport, oDlg

FUNCTION Main()

   SET CENTURY ON
   SET DATE BRITISH
   SET TIME FORMAT TO "HH:MM:SS"
   SET EPOCH TO Year( Date() ) - 30

   USE Customer ALIAS Test

   myReport()

RETURN NIL

FUNCTION myReport()

   LOCAL oFont1, oFont2, oFont3, oBmp, oPen1, oPen2
   LOCAL nfila := -1
   LOCAL lLand

   DEFINE FONT oFont1 NAME "ARIAL" SIZE 0, - 10
   DEFINE FONT oFont2 NAME "ARIAL" SIZE 0, - 10 BOLD
   DEFINE FONT oFont3 NAME "ARIAL" SIZE 0, - 10 BOLD ITALIC

   DEFINE PEN oPen1 Width 2 COLOR CLR_CYAN
   DEFINE PEN oPen2 WIDTH 2 COLOR CLR_GREEN

   GO TOP

   REPORT oReport                                              ;
      TITLE  "*** LISTADO DE PRUEBA ***",                      ;
      "",                                                      ;
      OemtoAnsi( "FiveTech Software" ),                        ;
      ""                                                       ;
      FONT   oFont1,                                           ;
      oFont2,                                                  ;
      oFont3                                                   ;
      PEN    oPen1,                                            ;
      oPen2                                                    ;
      HEADER "Fecha: " + DToC( Date() ),                       ;
      "Hora..: " + Time()                                      ;
      FOOTER OemtoAnsi( "P gina: " ) + Str( oReport:nPage, 3 ) ;
      CENTERED                                                 ;
      PREVIEW

   lLand := IF( oReport:oDevice:GetOrientation() == 1, ( .F. ), ( .T. ) )

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

   IF lLand

      MsgInfo( "LANDSCAPE", "Reporte" )

      PrnLandScape()   // Horizontal

      oReport:lAutoLand := .T.

   ELSE

      MsgInfo( "PORTRAIT", "Reporte" )

      PrnPortrait() // Vertical

      oReport:lAutoLand := .F.

   ENDIF

   COLUMN TITLE "Fila" DATA AllTrim( Str( nFila += 0.5 ) )

   COLUMN TITLE "ST"       ;
      DATA Test->STATE     ;
      FONT 2

   COLUMN TITLE "City" ;
      DATA Test->City

   COLUMN TITLE "First Name", "Last Name" ;
      DATA Test->First, Test->Last

   COLUMN TITLE "   Salary"   ;
      DATA Test->Salary       ;
      PICTURE "9,999,999"     ;
      SIZE 9                  ;
      TOTAL                   ;
      SHADOW                  ;
      GRID 2

   END REPORT

   IF .NOT. oReport:lCreated

      RETURN NIL

   ELSE

      oReport:SetTxtColor( CLR_HBLUE, 1 )
      oReport:SetTxtColor( CLR_HRED, 2 )
      oReport:SetTxtColor( CLR_HBLUE, 3 )
      oReport:SetPenColor( CLR_CYAN   )
      oReport:SetShdColor( CLR_HCYAN  )

   ENDIF

   oReport:CellView()

   ACTIVATE REPORT oReport

   oFont1:End()
   oFont2:End()
   oFont3:End()

   oPen1:End()
   oPen2:End()

RETURN NIL
 

Re: set Report Orientation

PostPosted: Mon Jan 03, 2022 5:34 am
by Silvio.Falconi
PERHAPS YOU NOT READ THE QUESTION.
I make

oBrw:Report( 'Stampa elenco ', , , ;
{ |oRep, oBrw | MySetUp( oRep, oBrw, lLandscape ) } )

I know how make the orientation if i must use the prg you wrote, but I call report() from oBrw directly

Re: set Report Orientation

PostPosted: Tue Jan 04, 2022 12:21 am
by Silvio.Falconi
If I make
local lLandscape :=.t.
...
DEFINE DIALOG oDlgStampa

@ 14,70 CHECKBOX oGetland VAR lLandscape PROMPT "Stampa in Orizzontale";
SIZE 120,26 of oDlgStampa

ACTIVATE DIALOG oDlgStampa CENTER


IF oDlgStampa:nresult == IDOK
?llandscape //here is .t.

bSetUp := {|oRep, oBrw, n, llandscape| MyRepSetup( oRep, oBrw, n,llandscape )}
oBrw:Report("Elenco Categorie",.T.,,bSetUp )

Endif


function MyRepSetup( oRep, oBrw, n ,llandscape)

?llandscape //here is nil

if llandscape
oRep:lAutoLand := .T.
else
oRep:lAutoLand := .f.
Endif

oRep:CellView()
oRep:oFooter := TrLine():New( {{|| "Page : "+Str(oRep:nPage,3)} }, oRep, 3 )

return nil

Re: set Report Orientation

PostPosted: Tue Jan 04, 2022 8:56 am
by Otto

Re: set Report Orientation

PostPosted: Fri Jan 07, 2022 7:42 am
by Silvio.Falconi


Otto,
I use a xbrowse and call report class from it, no prn
bSetUp := {|oRep, oBrw, n, llandscape| MyRepSetup( oRep, oBrw, n,llandscape )}
oBrw:Report("Elenco Categorie",.T.,,bSetUp )

Re: set Report Orientation

PostPosted: Fri Jan 07, 2022 7:53 am
by Otto
Silvio,
It uses the same source code.
It does not work like that. It is very complicated to change.
It's an open case.
Best regards,
Otto

Re: set Report Orientation

PostPosted: Fri Jan 07, 2022 8:02 am
by Silvio.Falconi
Otto wrote:Silvio,
It uses the same source code.
It does not work like that. It is very complicated to change.
It's an open case.
Best regards,
Otto


sorry U are usinf printer class instead report class
i know how it must be done with the printer class, but in this context i am calling a report from an xbrowse class, maybe you didn't understand the problem

Re: set Report Orientation

PostPosted: Fri Jan 07, 2022 10:03 am
by Otto
Silvio, you use TPrinter.
Look into xBrowse class. There you see that xBrowse class uses printer class.
xbrowse.prg
Code: Select all  Expand view

METHOD Report( cTitle, lPreview, lModal, bSetUp, aGroupBy, cPDF ) CLASS TXBrowse

   local oRep, oPrn, oFont, oBold, uRet
   local aCols, nFor, oCol, uBookMark
   local oBrw := Self
   local lAddCols := .T.
   local nRows, nSel, n
   local lEof     := .f.
   local lSetUpTwice := .f.
   local nLevels

   DEFAULT cTitle   := If( ::oWnd:ClassName == 'TPANEL', ::oWnd:oWnd:cTitle, ::oWnd:cTitle )
   DEFAULT lPreview := .T.
   DEFAULT lModal   := .T.

   if ::nLen < 1 .or. Empty( ::GetVisibleCols )
      return nil
   endif

   oPrn :=  PrintBegin( cTitle, ;            // document
                        .f., ;              // luser
                        lPreview, nil, ;    // xmodel
                        lModal, ;
                        .f.,    ;           // lselect
                        cPDF )              // PDF to Save
 


Here you see that function PrintBegin comes from printer.prg.

Code: Select all  Expand view


function PrintBegin( cDoc, lUser, lPreview, xModel, lModal, lSelection, cFile )

   local cText, aPrn, nScan

   if xModel == nil
      return oPrinter := TPrinter():New( cDoc, lUser, lPreview,, lModal, lSelection, cFile )
   endif

   cText = StrTran( GetProfString( "Devices" ), Chr( 0 ), Chr( 13 ) + Chr( 10 ) )
   aPrn  = Array( MlCount( cText, 250 ) )

   AEval( aPrn, { | v, n | aPrn[ n ] := Trim( MemoLine( cText, 250, n ) ) } )

   if Valtype( xModel ) == "N"
      if xModel < 0 .or. xModel > Len( aPrn )
         nScan = 0
      else
         nScan = xModel
      endif
   else
      if ( nScan := Ascan( aPrn, { | v | Upper( xModel ) == Upper( v ) } ) ) == 0
         nScan = Ascan( aPrn, { | v | Upper( xModel ) $ Upper( v ) } )
      endif
   endif

   if nScan == 0
      MsgBeep()
      return oPrinter := TPrinter():New( cDoc, .T., lPreview,, lModal, lSelection, cFile )
   endif

return oPrinter := TPrinter():New( cDoc, .f., lPreview, aPrn[ nScan ], lModal,;
                                   lSelection, cFile )

//----------------------------------------------------------------------------//

Myworkaround is does the job but you first has to setup for the printer model the orientation.



 


From my notes:
Best regards,
Otto
Image

Re: set Report Orientation

PostPosted: Fri Jan 07, 2022 10:26 am
by Otto
Silvio, here you see | i zi pi zi| handling orientation.
Best regards,
Otto


Image

Re: set Report Orientation

PostPosted: Fri Jan 07, 2022 10:35 am
by Silvio.Falconi
and wich is the command I not understood


oBrw:Report( 'Stampa elenco ', , , ;
{ |oRep, oBrw | MySetUp( oRep, oBrw, lLandscape ) } )

I not want make report with ziziz zipizizi or another bullshit you did when you saw that I was doing something to print

I ask for a specific thing oBrw:report() <<<<<----------------------

and does not care if the xbrowse report method uses Printbegin()

I asked how do you do it?

Now you are all expert professors, You are all good at doing classes, on the other hand, have remained a donkey and have to suffer your bullying

I saw well that the report method uses PrintBegin() did not have to teach me

I asked you how to do it, I didn't ask you to show me how you do all on your zizizpizi

but every time the same story, every time I ask for something to report or print you answer you put this zizizipizi implying to use your zizizpizi,

now enough it bothered me

But do you think I'm enjoying myself asking for help on the forum? or is it working to solve my problems?

I am tailed by you and someone else just hangs up I insert a topic immediately responding with other topics and with incorrect answers

Re: set Report Orientation

PostPosted: Fri Jan 07, 2022 10:50 am
by Otto
viewtopic.php?f=6&t=40145&p=242740&hilit=orientation&sid=1e156c84b09d5a82f13dda3a84ef6cd1#p242740


Silvio, sorry, there is no solution available at the moment.
I use these workarounds.
Best regards,
Otto



Code: Select all  Expand view



function hochformat()
    winexec('RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Sr /n "Seminar" /a "c:\setprnter\Seminarhoch.dat"')
return nil

function landscape()
    winexec('RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Sr /n "Seminar" /a "c:\setprnter\Seminar.dat"')
return nil

Re: set Report Orientation

PostPosted: Fri Jan 07, 2022 10:53 am
by Silvio.Falconi
Otto wrote:http://forums.fivetechsupport.com/viewtopic.php?f=6&t=40145&p=242740&hilit=orientation&sid=1e156c84b09d5a82f13dda3a84ef6cd1#p242740


Silvio, sorry, there is no solution available at the moment.
I use these workarounds.
Best regards,
Otto



Code: Select all  Expand view



function hochformat()
    winexec('RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Sr /n "Seminar" /a "c:\setprnter\Seminarhoch.dat"')
return nil

function landscape()
    winexec('RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Sr /n "Seminar" /a "c:\setprnter\Seminar.dat"')
return nil


I'm not interested

I asked for a specific thing

I don't think it can't be done

I know that in fwh you can do many things that you don't even imagine, but unfortunately I can't publish them and I keep them to myself because if I publish them they are the end of many things I have published

Re: set Report Orientation

PostPosted: Fri Jan 07, 2022 12:32 pm
by Otto
Silvio,
currently there is no solution available in Fivewin.

If you find a solution, please post it here to help others.

Best regards,
Otto

Re: set Report Orientation

PostPosted: Fri Jan 07, 2022 6:46 pm
by Massimo Linossi
Very kind, as always.

Silvio.Falconi wrote:and wich is the command I not understood

oBrw:Report( 'Stampa elenco ', , , ;
{ |oRep, oBrw | MySetUp( oRep, oBrw, lLandscape ) } )

I not want make report with ziziz zipizizi or another bullshit you did when you saw that I was doing something to print

I ask for a specific thing oBrw:report() <<<<<----------------------

and does not care if the xbrowse report method uses Printbegin()

I asked how do you do it?

Now you are all expert professors, You are all good at doing classes, on the other hand, have remained a donkey and have to suffer your bullying

I saw well that the report method uses PrintBegin() did not have to teach me

I asked you how to do it, I didn't ask you to show me how you do all on your zizizpizi

but every time the same story, every time I ask for something to report or print you answer you put this zizizipizi implying to use your zizizpizi,

now enough it bothered me

But do you think I'm enjoying myself asking for help on the forum? or is it working to solve my problems?

I am tailed by you and someone else just hangs up I insert a topic immediately responding with other topics and with incorrect answers