Jump to content
Fivewin Brasil

relatório desconfigurado


Alain da Silva

Recommended Posts

Bom dia, como resolver o problema com relatórios desconfigurados, em um cliente com a impressora laser hp jetpro aparece desse jeito, na minha máquina aparece normal.

#include "FiveWin.ch"
#include "Utilprn.ch"
#include "CORES.ch"

FUNCTION RELCLI()
  LOCAL OPRN,oUtil
  Local OBRUSH
  Local nColor := CINZACL
  IF VERIFICAIMP()
  ELSE
     RETURN(.F.)
  ENDIF
  PRINTER OPRN NAME "RELATORIO DE CLIENTE" preview MODAL
*-----------------------------------------------------------
  OPRN:SETPAGE(9)
  DEFINE FONT oFnt0  NAME "Arial" SIZE 0,-6      OF OPRN
  DEFINE FONT oFnt0B NAME "Arial" SIZE 0,-6 BOLD OF OPRN
  DEFINE FONT oFnt8  NAME "Arial" SIZE 0,-8      OF OPRN
  DEFINE FONT oFnt8B NAME "Arial" SIZE 0,-8 BOLD OF OPRN
  DEFINE FONT oFnt10 NAME "Arial" SIZE 0,-10     OF OPRN
  DEFINE FONT oFNT3  NAME "Times New Roman" SIZE 0, -8       OF oPrn
  DEFINE FONT oFNT4  NAME "Times New Roman" SIZE 0, -10 BOLD OF oPrn
  DEFINE FONT oFNT5  NAME "Times New Roman" SIZE 0, -14 BOLD OF oPrn
  DEFINE FONT oFNT6  NAME "Times New Roman" SIZE 0, -16 BOLD OF oPrn
  DEFINE FONT fTitulo    NAME "Times New Roman"  SIZE 0,-17      OF OPRN
  DEFINE FONT fExpandido NAME "Arial"            SIZE 0,-12      OF OPRN
  DEFINE FONT fNormal6   NAME "Arial"            SIZE 0,-6       OF OPRN
  DEFINE FONT fNormal8   NAME "Arial"            SIZE 0,-8       OF OPRN
  DEFINE FONT fNormal9   NAME "Arial"            SIZE 0,-9       OF OPRN
  DEFINE FONT fNormal10  NAME "Arial"            SIZE 0,-10      OF OPRN
  DEFINE PEN  oPen   WIDTH 3 COLOR CLR_BLACK
  DEFINE PEN  oPen2  WIDTH 3 COLOR CLR_WHITE
  DEFINE UTILPRN     oUtil PEN oPen OF oPrn
  DEFINE BRUSH       OBRUSH COLOR nColor
*-----------------------------------------------------------
  PAG := 1
  BEGIN SEQUENCE
     CABECALHO("RELATÓRIO DE CLIENTE","",OPRN,PAG,oUtil)
     XLN:=3.5
     LN:=3.5
     sele 1
     dbsetorder(2)
     ARQCLI->(dbgotop())
     DO WHILE !ARQCLI->(EOF())
        UTILPRN OUTIL XLN,1 SAY ARQCLI->RAZAO    FONT ofnt4
        UTILPRN OUTIL XLN,20.2 SAY ARQCLI->TELEFONE FONT ofnt4 right
        XLN := XLN + 0.4
        UTILPRN oUtil XLN,1 SAY ALLTRIM(ARQCLI->ENDERECO)+" , "+ALLTRIM(ARQCLI->NUMERO)+" , "+ALLTRIM(ARQCLI->BAIRRO) FONT ofnT4
        XLN := XLN + 0.4
        UTILPRN oUtil XLN,1 SAY ARQCLI->CGCCLI+" - I.E."+IIF(ALLTRIM(ARQCLI->INSCEST)<>" ",ARQCLI->INSCEST,"I.E. ISENTO") FONT ofnT4
        XLN := XLN + 0.4
        UTILPRN oUtil XLN,1 SAY ALLTRIM(ARQCLI->CIDADE)+"/"+ARQCLI->ESTADO+" - CEP "+ARQCLI->CEPCLI FONT ofnT4
        UTILPRN oUtil BOX XLN+.5,0.5 TO XLN+.5+.01,20.2  PEN oPen
        XLN := XLN + 0.7
        LN := LN + 5
        IF LN >= 65
           PULAPAGINA(@LN,"RELATÓRIO DE CLIENTE",,@PAG,@XLN,OPRN,OUTIL,,65)
        ENDIF
        SELE 1
        ARQCLI->(DBSKIP())
        UNLOCK
     ENDDO
  END SEQUENCE
  ENDPAGE
  ENDPRINT
  OUTIL:END()
  OPEN:END()
  OFNT0:END()
  OFNT0B:END()
  oFnt8:END()
  oFnt8B:END()
  oFnt10:END()
  OFNT3:END()
  OFNT4:END()
  OFNT5:END()
  OFNT6:END()
  OPRN:END()
  OPEN:END()
  OPEN2:END()
  CURSORARROW()
  RETURN NIL

nno20m.jpgkcjgy9.jpg

Link to comment
Share on other sites

/*

Use:

nRowStep = oPrn:nVertRes() / 20 // We want 20 rows

nColStep = oPrn:nHorzRes() / 15 // We want 15 cols


Para imprimir em qualquer impressora.

*/



// Sample showing how to manage the printer object

#include "FiveWin.ch"

static oWnd

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

function Main()

local oPrn, oFont
local nRowStep, nColStep
local nRow := 0, nCol := 0, n, m

// PrnSetSize( 2100, 1200 ) To adjust a different printer paper size!

PRINT oPrn NAME "Testing the printer object from FiveWin" PREVIEW

if Empty( oPrn:hDC )
return nil // Printer was not installed or ready
endif

DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -12 OF oPrn

nRowStep = oPrn:nVertRes() / 20 // We want 20 rows
nColStep = oPrn:nHorzRes() / 15 // We want 15 cols

PAGE
oPrn:SayBitmap( 1, 1, "..\bitmaps\fivewin.bmp" )
for n = 1 to 20 // rows
nCol = 0
oPrn:Say( nRow, nCol, Str( n, 2 ), oFont )
nCol += nColStep
for m = 1 to 15
oPrn:Say( nRow, nCol, "+", oFont )
nCol += nColStep
next
nRow += nRowStep
next
oPrn:Line( 0, 0, nRow, nCol )
ENDPAGE

PAGE
nRow = 0
oPrn:SayBitmap( 1, 1, "..\bitmaps\fivewin.bmp" )
for n = 1 to 20 // rows
nCol = 0
oPrn:Say( nRow, nCol, Str( n + 20, 2 ), oFont )
nCol += nColStep
for m = 1 to 15
oPrn:Say( nRow, nCol, "+", oFont )
nCol += nColStep
next
nRow += nRowStep
next
oPrn:Line( 0, 0, nRow, nCol )
ENDPAGE

ENDPRINT

oFont:End() // Destroy the font object

return nil



Link to comment
Share on other sites

Alain,

Eu sempre uso da forma como o Kapiaba mostrou.

O tamanho da fonte deve ser alterado em função do número de colunas. Eu costumo usar uma fonte sem micro espacejamento.

Para Retrato e A4 eu uso 66 linhas por página.

Define Font oFntPrn Name "Lucida Console" Size 0,-9 Of oPrn
oPrn:SetPortrait() // retrato
oPrn:SetPage(9) // A4
nCStep := oPrn:nHorzRes() / 102 // colunas
nRStep := oPrn:nVertRes() / 66 // linhas

Um abraço!

Rodrigo Melo

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...