Re: Clase TDirectPrint
Posted: Wed Feb 20, 2013 8:20 pm
Gracias William
Saludos,
Adhemar
Saludos,
Adhemar
www.FiveTechSoft.com
https://fivetechsupport.com/forums/
Code: Select all | Expand
#include <fivewin.ch>
function Main()
local oPrn
local i
local nRow := 1
local nPagina := 1
oPrn := TDirectPrint():New('lpt1')
oPrn:beginprint()
for i := 1 to 330
if nRow = 1
oPrn:bold( .t. )
oPrn:normal()
oPrn:say( nRow, 10, 'Codigo' )
oPrn:say( nRow, 60, 'Pagina:' + cstr(nPagina) )
oPrn:bold( .f. )
oPrn:condensed()
nRow++
endif
oPrn:say( nRow, 10, cstr(i) )
nRow ++
if nRow >= 55
oPrn:eject()
nRow := 1
nPagina ++
endif
next
oPrn:endprint()
return nil
FUNCTION WCStr( xExp, nDecimals )
LOCAL cType
IF xExp == NIL
RETURN 'NIL'
ENDIF
cType := ValType( xExp )
SWITCH cType
CASE 'C'
RETURN xExp
CASE 'D'
RETURN dToS( xExp )
CASE 'L'
RETURN IIF( xExp, '.T.', '.F.' )
CASE 'N'
IF !HB_IsNil( nDecimals )
RETURN AllTrim(Str( xExp, 11, nDecimals ))
ELSE
RETURN AllTrim(Str( xExp ))
ENDIF
CASE 'A'
RETURN "{ Array of " + LTrim( Str( Len( xExp ) ) ) + " Items }"
CASE 'B'
RETURN '{|| Block }'
CASE 'O'
RETURN "{ " + xExp:ClassName() + " Object }"
CASE 'P'
RETURN NumToHex( xExp )
CASE 'H'
RETURN "{ Hash of " + LTrim( Str( Len( xExp ) ) ) + " Items }"
DEFAULT
RETURN "Type: " + cType
END
RETURN ""
#include "wtraw.prg"
sysctrl2 wrote:Viendo un poquito la class tDirecPrint,
deberia de funcionar con el siguiente ejemplo,
ya nos dira el buen amigo william,
saludos..Code: Select all | Expand
#include <fivewin.ch>
function Main()
local oPrn
local i
local nRow := 1
local nPagina := 1
oPrn := TDirectPrint():New('lpt1')
oPrn:beginprint()
for i := 1 to 330
if nRow = 1
oPrn:bold( .t. )
oPrn:normal()
oPrn:say( nRow, 10, 'Codigo' )
oPrn:say( nRow, 60, 'Pagina:' + cstr(nPagina) )
oPrn:bold( .f. )
oPrn:condensed()
nRow++
endif
oPrn:say( nRow, 10, cstr(i) )
nRow ++
if nRow >= 55
oPrn:eject()
nRow := 1
nPagina ++
endif
next
oPrn:endprint()
return nil
FUNCTION WCStr( xExp, nDecimals )
LOCAL cType
IF xExp == NIL
RETURN 'NIL'
ENDIF
cType := ValType( xExp )
SWITCH cType
CASE 'C'
RETURN xExp
CASE 'D'
RETURN dToS( xExp )
CASE 'L'
RETURN IIF( xExp, '.T.', '.F.' )
CASE 'N'
IF !HB_IsNil( nDecimals )
RETURN AllTrim(Str( xExp, 11, nDecimals ))
ELSE
RETURN AllTrim(Str( xExp ))
ENDIF
CASE 'A'
RETURN "{ Array of " + LTrim( Str( Len( xExp ) ) ) + " Items }"
CASE 'B'
RETURN '{|| Block }'
CASE 'O'
RETURN "{ " + xExp:ClassName() + " Object }"
CASE 'P'
RETURN NumToHex( xExp )
CASE 'H'
RETURN "{ Hash of " + LTrim( Str( Len( xExp ) ) ) + " Items }"
DEFAULT
RETURN "Type: " + cType
END
RETURN ""
#include "wtraw.prg"