Mandando un Preview de Report de frente a PDF

Mandando un Preview de Report de frente a PDF

Postby Enrrique Vertiz » Wed Mar 14, 2018 3:58 am

Estimados saludos

Tengo un REPORT comun y silvestre, codigo abajo adjunto, tiene un Preview y por lo tanto muestra el Preview, lo que quisiera hacer es que, sin que se tenga que presionar nada mas, use la opcion de "guardar como PDF", grabe el Preview como PDF y cierre el preview ... alguna idea ??
Muchas gracias ...

Code: Select all  Expand view
  sele 97
   DEFINE FONT oFo1 NAME "ARIAL" SIZE 0, -nTle
   DEFINE FONT oFo2 NAME "ARIAL" SIZE 0, -nTle BOLD

   cTi3:= "*** Impresion de Sustento de Pagos ***"

   cTit:="Banco : "+cNomBan+", CtaCte : "+cBanCte

   REPORT oRep HEADER "  Fecha : "+dtoc(date())+" - Hora  : "+time() LEFT ;
          CAPTION "*** Impresion en Formato de Voucher ***" ;
          TITLE  cTi3,cTit,iif(wfempt=="N","",(cEmp+" - "+alltrim(cNoe)+" - "+cAno)) CENTER ;
          FOOTER "Pagina # : "+str(oRep:npage,3) LEFT ;
          FONT oFo1,oFo2 PREVIEW

          COLUMN TITLE "Cuenta"               DATA alltrim(97->cdo_cuenta) SIZE 9
          COLUMN TITLE "Proveedor"            DATA alltrim(97->cdo_auxili) SIZE 10
          COLUMN TITLE "Nombre - Razon Social"     DATA alltrim(97->des_auxili) SIZE 30
          COLUMN TITLE "Td"                   DATA 97->tip_docume SIZE 2
          COLUMN TITLE "Doc.Numero"           DATA alltrim(97->num_docume) SIZE 14
          COLUMN oCo1 TITLE "         Soles"  DATA 97->sal_monnac PICTURE "999,999,999.99" TOTAL RIGHT FONT 2 SIZE 10
          COLUMN oCo2 TITLE "       Dolares"  DATA 97->sal_monext PICTURE "999,999,999.99" TOTAL RIGHT FONT 2 SIZE 10

   END REPORT

   oRep:cPageTotal:= "Total Pagina"       // Titulo de Totales por Pagina
   oRep:cGrandTotal:="Total General"      // Titulo de Total General
   oRep:lPageTotal:=.f.                   // Quitar Total x Pagina
   oRep:oDevice:SetPortrait()             // Vertical en TReport
   oRep:oDevice:lPrvModal:=.t.            // Para que Preview salga de Frente no en una Ventana aparte

   ACTIVATE REPORT oRep ON STARTGROUP oRep:NewLine() // ON INIT oRep:TPreview:SaveAs(.t.,.f.)  


Image
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23.1026X, Fwh 24.02, MySQL 8.0.X, SQLLIB 1.9m
Enrrique Vertiz
 
Posts: 519
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru

Re: Mandando un Preview de Report de frente a PDF

Postby armando.lagunas » Wed Mar 14, 2018 12:06 pm

Code: Select all  Expand view


...
...
 SET 3DLOOK OFF
 PRINTER oPrn TO "Impresora Prederminada" FILE ".\InformesPdf\Nombre archivo.pdf"  PREVIEW
 IF EMPTY( oPrn:hDC )
    RETURN NIL
 ENDIF

 REPORT oRep HEADER "  Fecha : "+dtoc(date())+" - Hora  : "+time() LEFT ;
          CAPTION "*** Impresion en Formato de Voucher ***" ;
          TITLE  cTi3,cTit,iif(wfempt=="N","",(cEmp+" - "+alltrim(cNoe)+" - "+cAno)) CENTER ;
          FOOTER "Pagina # : "+str(oRep:npage,3) LEFT ;
          FONT oFo1,oFo2  ;
          TO DEVICE oPrn
.....
.....

 


con agregarle
Code: Select all  Expand view
TO DEVICE oPrn
te crea automaticamente un archivo Pdf en el directorio que le escribas en el objeto oPrn, lo utilizo permanentemente y funciona muy bien


Saludos
SkyPe: armando.lagunas@hotmail.com
Mail: armando.lagunas@gmail.com
User avatar
armando.lagunas
 
Posts: 346
Joined: Mon Oct 05, 2009 3:35 pm
Location: Curico-Chile

Re: Mandando un Preview de Report de frente a PDF

Postby Enrrique Vertiz » Fri Mar 16, 2018 12:35 am

Saludos Armando

Gracias por la informacion, ya habia metido mano a la clase, pero esto es mas directo, lo reviso ...
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23.1026X, Fwh 24.02, MySQL 8.0.X, SQLLIB 1.9m
Enrrique Vertiz
 
Posts: 519
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 57 guests