Jump to content
Fivewin Brasil

Impressão relatórios


helgodoy

Recommended Posts

o godoy:

ja ajudei um pessoal ai com negocio de fonte para varios tamanhos, dai repito a funçao que ja postei aqui, em versão mais aperfeicoada ainda :

/* FUN€AO DESENHADA POR ERIC CLAPTON E B.B. KING

FUNCAO PARA ESCOLHER QUAL O TAMANHO DE FONTE

ADEQUADO PARA A FONTE ESCOLHIDA, IMPRESSORA ESCOLHIDA E

QUANTOS CARACTERES O USUARIO QUER NA LINHA, NA HORIZONTAL

TOTALMENTE INDEPENDENTE DO TIPO, MARCA E RESOLUCAO DA PRINTER !!

Parametros :

oPrn -> objeto da impressao

font_name -> adivinha...

nCaractLine -> quantos carateres na linha horizontal

Retorna :

oFont -> objeto da fonte apropriada

deltapx -> quantos pixel tem que avancar cada linha de impressao gráfica para se ter 6 linhas por polegada, isso ‚ pra ser usado somente

se nÆo quizer juntar a linhas, quando a fonte for muito pequena,

senao o relatorio fica "inl¡vel" !!! Padrao manjado de 6 lines/inch

nLinesPage -> quantas linhas vai caber por pagina se avan‡ar usando deltapx

*/

*********************************************

function pick_font(oPrn,font_name,nCaractLine,vertical,bold)

*********************************************

local oFont,size,deltapx,nCaract,nLinesPage

if valtype(bold) # "L"

bold := .F.

endif

if valtype(vertical) # "L"

vertical := .t.

endif

for size := 20 to 100 step .01

oFont := TFont():New( font_name, 0, -1 * size ,.f.,bold,,,,,,,,,,, )

if valtype(oFont) # "O"

return { NIL , 0 , 0 }

endif

if vertical

nCaract := int ( 0.725 * oPrn:nHorzRes() / oFont:nWidth )

else

nCaract := int ( 0.725 * oPrn:nVertRes() / oFont:nWidth )

endif

// achou um tamanho que serve !! - sai fora !!

if nCaract <= nCaractLine

exit

endif

oFont:End()

next

// TENTOU 200 VEZES E NADA !!!!!!!!!

// DEVE SER IMPRESSORA DE IMPRIMIR LOGOTIPO EM NEURONIO DE AMEBA !!

if valtype(oFont) # "O"

return { NIL , 0 , 0 }

endif

if vertical

// avanco vertical padrao desejado em pixel

nLinesPage := int ( oPrn:nVertSize() / ( 25.4 / 6 ) )

deltapx := oPrn:nVertRes() / nLinesPage

if oFont:nHeight + 3 > deltapx && FONTE FICOU MUITO GRANDE !!!!!

deltapx := oFont:nHeight + 3

nLinesPage := int ( oPrn:nVertSize() / deltapx )

endif

else

// avanco vertical padrao desejado em pixel

nLinesPage := int ( oPrn:nHorzSize() / ( 25.4 / 6 ) )

deltapx := oPrn:nHorzRes() / nLinesPage

if oFont:nHeight + 3 > deltapx && FONTE FICOU MUITO GRANDE !!!!!

deltapx := oFont:nHeight + 3

nLinesPage := int ( oPrn:nHorzSize() / deltapx )

endif

endif

return {oFont,deltapx,nLinesPage}

ABRAÇAO

ESSA RESOLVE EU GARANTO

BM

FW1.92+Clipper 5.3+Lib+Blinker+BC++

Editado por - bluesman on 02/03/2005 17:50:59

Link to comment
Share on other sites

Definindo:

DEFINE FONT oFONT NAME "COURIER NEW" SIZE 0, -10 OF oPrn

DEFINE FONT oFONT1 NAME "COURIER NEW" SIZE 0, -8 OF oPrn

DEFINE FONT oFONT2 NAME "COURIER NEW" SIZE 0, -10 OF oPrn BOLD

Imprimindo:

oPRN:SAY(nROW*nLINHA,nCOL*7,"PRODUTO",oFONT)

oPRN:SAY(nROW*nLINHA,nCOL*87," QUANTIDADE",oFONT1)

oPRN:SAY(nROW*nLINHA,nCOL*100," VALOR",oFONT2)

Abraços...

Ronaldo Marins

Rio de Janeiro - RJ

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...