last useful line in a sheet

last useful line in a sheet

Postby Silvio.Falconi » Tue Apr 18, 2023 11:47 am

assuming you have an A4 format sheet
how can I calculate the last useful line to print ( with tprinter class) information like timestamp or page number?
I try with


@ 28, 0 PRINT TO oPrn TEXT TimeStamp() ;
SIZE 6.90, 0.8 CM ALIGN "TL" FONT oFnt COLOR CLR_BLACK

but not print any
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: last useful line in a sheet

Postby karinha » Tue Apr 18, 2023 3:51 pm

Mira se ayuda:

Mira se ayuda:

Code: Select all  Expand view  RUN

// c:\fwh..\samples\SILSTAMP.PRG

#include "FiveWin.ch"

#define PAD_LEFT            0
#define PAD_RIGHT           1
#define PAD_CENTER          2

static oWnd

MEMVAR nCopias

FUNCTION Main()

   nCopias := 1  // ponga en el dialogo Number of copies.

   DEFINE WINDOW oWnd FROM 1, 1 TO 20, 60 TITLE "Printing a Window"

   @ 3, 3 BUTTON "&Print me" OF oWnd SIZE 80, 20 ;
      ACTION PrintMe_Copias()  // try also with oWnd:HardCopy()

   @ 5, 3 BUTTON "&End"      OF oWnd SIZE 80, 20 ;
      ACTION ( oWnd:End() )

   ACTIVATE WINDOW oWnd CENTERED

RETURN NIL

FUNCTION PrintMe_Copias()

   LOCAL nI

   FOR nI := 1 TO nCopias

      SYSREFRESH()

      PrintMe()

   NEXT

RETURN NIL

FUNCTION PrintMe()

   LOCAL oPrn, oFont, oPen, aPrn, nLinha, nColuna, ResLinha, ResColuna
   LOCAL cData := Date(), cText

   aPrn := GetPrinters()

   IF Empty( aPrn ) // Empty( oPrn:hDC )

      MsgStop ("No se encontró impresora", "No se encontró impresora")

      RETURN NIL

   ENDIF

   PRINTER oPrn PREVIEW MODAL // PARA TESTAR A IMPRESSORA ANTES DE IMPRIMIR

   IF EMPTY( oPrn:hDC )

       MsgInfo ("HABÍA ALGO MAL CON LA IMPRESORA", "ENCIENDA LA IMPRESORA")

      oPrn:End()

      RETURN( .F. )

   ENDIF

   oPrn:End()

   cText := TimeZone( cData ) // EL TEXTO para el preview.

   PRINT oPrn PREVIEW MODAL

      DEFINE FONT oFont NAME "Arial" SIZE 0, -30 BOLD OF oPrn
      DEFINE PEN oPen WIDTH  2                        OF oPrn
 
      oPrn:SetPage(9)
      oPrn:SetPortrait()

      ResLinha  := oPrn:nLogPixely()/2.54
      ResColuna := oPrn:nLogPixelx()/2.54

      nLinha    := 01
      nColuna   := 10

      PAGE

         @ 15, 01 PRINT TO oPrn TEXT cText SIZE 19,3 CM FONT oFont COLOR CLR_RED

         @ 19, 05 PRINT TO oPrn TEXT cText SIZE 19,3 CM ALIGN "TL" FONT oFont COLOR CLR_BLACK

         oPrn:Say( nLinha * ResLinha,  7.25 * ResColuna,                     ;
                   "TimeZone: " + TimeZone( cData ), oFont,, CLR_BLACK,, PAD_CENTER )

      ENDPAGE

   ENDPRINT

   oFont:End()

RETURN NIL

FUNCTION TimeZone( dData )

   Local cDateTimeZone,aTimeStamp,cTzd

   Default dData:=Date()

   aTimeStamp := hb_atokens(tip_timestamp(dData)," ")

   cTzd:=aTail(aTimeStamp)

   cTzd:=Left(cTzd,Len(cTzd)-2)+":"+Right(cTzd,2)

   cDateTimeZone:=StrZero(Year(dData),4)+"-"+StrZero(Month(dData),2)+"-"+StrZero(Day(dData),2)+"T"+Time()+cTzd

Return( cDateTimeZone )

// fin / end
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: last useful line in a sheet

Postby nageswaragunupudi » Tue Apr 18, 2023 11:39 pm

Code: Select all  Expand view  RUN
#include "fivewin.ch"

function Main()

   local oPrn, oFont

   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "VERDANA" SIZE 0,-12 OF oPrn
   PAGE
   @ 1,1 PRINT TO oPrn TEXT HB_DateTime() ;
      SIZE oPrn:PageWidth(  "INCHES" ) - 1.5, ;
           oPrn:PageHeight( "INCHES" ) - 1.5  ;
           INCHES ;
      ALIGN "BR" FONT oFont
   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: last useful line in a sheet

Postby Silvio.Falconi » Thu Apr 20, 2023 9:16 am

nageswaragunupudi wrote:
Code: Select all  Expand view  RUN
#include "fivewin.ch"

function Main()

   local oPrn, oFont

   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "VERDANA" SIZE 0,-12 OF oPrn
   PAGE
   @ 1,1 PRINT TO oPrn TEXT HB_DateTime() ;
      SIZE oPrn:PageWidth(  "INCHES" ) - 1.5, ;
           oPrn:PageHeight( "INCHES" ) - 1.5  ;
           INCHES ;
      ALIGN "BR" FONT oFont
   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont

return nil
 


Image



Nages,
run ok
as you can see here

Image

How could I calculate any page numbers and page total?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: last useful line in a sheet

Postby Silvio.Falconi » Thu Apr 20, 2023 9:17 am

Silvio.Falconi wrote:
nageswaragunupudi wrote:
Code: Select all  Expand view  RUN
#include "fivewin.ch"

function Main()

   local oPrn, oFont

   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "VERDANA" SIZE 0,-12 OF oPrn
   PAGE
   @ 1,1 PRINT TO oPrn TEXT HB_DateTime() ;
      SIZE oPrn:PageWidth(  "INCHES" ) - 1.5, ;
           oPrn:PageHeight( "INCHES" ) - 1.5  ;
           INCHES ;
      ALIGN "BR" FONT oFont
   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont

return nil
 





Nages,
run ok
as you can see here

Image

How could I calculate any page numbers and page total?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7066
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 100 guests

cron