FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Preview y problemas de exportaci贸n.
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Preview y problemas de exportaci贸n.
Posted: Wed Mar 07, 2018 06:55 PM
Colegas, hasta ahora hab铆a probado la exportaci贸n a .Doc que viene por defecto en el preview con documentos de muy pocas p谩ginas, dos o tres. Estoy intentando generar un .Doc con un documento de 42 p谩ginas y obtengo este error

Code (fw): Select all Collapse
聽 Time from start: 0 hours 0 mins 21 secs 
聽 聽Error occurred at: 07/03/2018, 15:41:43
聽 聽Error description: (DOS Error -2147352567) WINOLE/1007 聽El filtro de gr谩ficos no pudo convertir este archivo. (0x800A1506): Microsoft Word
聽 聽Args:
聽 聽 聽[ 聽 1] = C 聽 C:\Users\Usuario\AppData\Local\Temp\67795937.emf
聽 聽 聽[ 聽 2] = L 聽 .F.
聽 聽 聽[ 聽 3] = L 聽 .T.

Stack Calls
===========
聽 聽Called from: 聽=> TOLEAUTO:ADDPICTURE( 0 )
聽 聽Called from: C:\t-fe_win10\rpreview.prg => CONVERTTOWORDDOC( 1658 )
聽 聽Called from: C:\t-fe_win10\rpreview.prg => TPREVIEW:SAVEAS( 1551 )
聽 聽Called from: C:\t-fe_win10\rpreview.prg => (b)TPREVIEW_BUILDBUTTONBAR( 203 )
聽 聽Called from: .\source\classes\TRBTN.PRG => TRBTN:CLICK( 717 )
聽 聽Called from: .\source\classes\TRBTN.PRG => TRBTN:LBUTTONUP( 917 )
聽 聽Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1721 )
聽 聽Called from: .\source\classes\TRBTN.PRG => TRBTN:HANDLEEVENT( 1575 )
聽 聽Called from: .\source\classes\WINDOW.PRG => _FWH( 3325 )
聽 聽Called from: 聽=> SYSREFRESH( 0 )
聽 聽Called from: C:\t-fe_win10\util.prg => STOPUNTIL( 1615 )
聽 聽Called from: C:\t-fe_win10\rpreview.prg => TPREVIEW:ACTIVATE( 155 )
聽 聽Called from: C:\t-fe_win10\rpreview.prg => RPREVIEW( 1625 )
聽 聽Called from: .\source\classes\REPORT.PRG => (b)TREPORT_NEW( 175 )
聽 聽Called from: .\source\classes\REPORT.PRG => TREPORT:ACTIVATE( 857 )
聽 聽Called from: C:\t-fe_win10\facturas_fe.prg => RPTFACTURAS( 1566 )
聽 聽Called from: C:\t-fe_win10\facturas_fe.prg => (b)TABLAFACTURAS( 230 )
聽 聽Called from: C:\t-fe_win10\h_TTaskItem.prg => TTASKITEM:LBUTTONUP( 317 )
聽 聽Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1721 )
聽 聽Called from: C:\t-fe_win10\h_TTaskItem.prg => TTASKITEM:HANDLEEVENT( 258 )
聽 聽Called from: .\source\classes\WINDOW.PRG => _FWH( 3325 )
聽 聽Called from: 聽=> WINRUN( 0 )
聽 聽Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1036 )
聽 聽Called from: C:\t-fe_win10\main.prg => START( 106 )
聽 聽Called from: C:\t-fe_win10\main.prg => MAIN( 32 )


Algo similar me ocurre cuando intento exportarlo a .pdf. Alguna idea ? Much铆simas gracias

Saludos
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Preview y problemas de exportaci贸n.
Posted: Wed Mar 07, 2018 06:59 PM

驴Has observado un incremento inusual en el consumo de memoria de la aplicaci贸n durante la conversi贸n? Monitoriza esto, yo con PDF cuando se exportaba como imagen no pod铆a crear m谩s de 20-25 p谩ginas ...

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Preview y problemas de exportaci贸n.
Posted: Wed Mar 07, 2018 07:13 PM
Talvez haya perdido la ruta de grabaci贸n, en el caso del PDF, lo hice as铆:

// PRV2PDF.PRG

Code (fw): Select all Collapse
function FWSavePreviewToPDF( oDevice, cPDF, lOpen )   // oDevice can be oPrinter or oPreview

   local cOrient, oPDF
   local hWnd

   if oDevice:IsKindOf( "TPREVIEW" )
      hWnd    := oDevice:oWnd:hWnd
      oDevice := oDevice:oDevice
   endif
#ifndef USEGDI
   if LoadFreeImage() <= 32
      MsgAlert( FWString( "freeimage.dll not found" ), FWString( "Alert" ) )
      return nil
   endif
#endif

   // MODIFICADO EM: 14/03/2016 PARA SALVAR O PDF NA PASTA: C:\NFEPDF
   cPRGPATH := cFILEPATH( "C:\NFEPDF\" )

   lCHDIR(cPRGPATH)

   // ? hb_CurDrive() + ":\" + CurDir() + "\"

   DEFAULT cPDF   := cGetFile( FWString( "PDF files | *.pdf |" ),;
                               FWString( "Select PDF File to Save" ),, ;
                               CurDir(), .T.,,,;
                               hb_CurDrive() + ":\" + CurDir() + "\" + ;
                               If( oDevice:IsKindOf( "TPreview" ),;
                               oDevice:cName, oDevice:cDocument ) + ".pdf"  )
   if ! Empty( cPDF )
      cPDF = cFileSetExt( cPDF, "pdf" )
      CursorWait()
      cOrient = If( oDevice:nHorzSize() > oDevice:nVertSize(), 'L', 'P' )
      oPdf = fwPdf():New( cPdf, cOrient )
      AEval( oDevice:aMeta, { | cMeta | oPdf:AddMeta( cMeta ) } )
      oPdf:Close()
      CursorArrow()

      DEFAULT lOpen := MsgYesNo( If( FWLanguageID() == 2, FWString( "驴" ) + " ", "" ) + ;
                       FWString( "View" ) + ;
                       " " + cPDF + " " + FWString( "(Y/N)" ) + " ?",;
                       FWString( "Please select" ) )

      if lOpen
         ShellExecute( IfNil( hWnd, GetWndDefault() ), "open", cPDF )
      endif
   else
      cPDF  := nil
   endif

   // VOLTO AO DIRETORIO DO PLENO PARA NAO QUEBRAR OS BANCOS.
   lCHDIR( cDirPleno )

   // ? hb_CurDrive() + ":\" + CurDir() + "\"

return cPDF
Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Preview y problemas de exportaci贸n.
Posted: Wed Mar 07, 2018 07:15 PM

Horacio,

Bienvenido al fabuloso mundo del OLE, los leaks y la fragmentacion de memoria de Harbour y LMQLP.

Yo he tenido que torear (con perd贸n) muchas veces con el Excel: sus man铆as, sus incompatibilidades entre versiones; con el xHarbour y Harbour y sus fragmentaciones de memoria irrecuperables, que ningun hb_gcall() puede solucionar.

De hecho a煤n tengo algunos problemas graves con OLE - Excel.

Posibles soluciones a tu caso:
-Intentar detectar alguna fuga de memoria (leaks)
- En vez de AddPicture(), utilizar otro metodo.

Convendr铆a, para todos, que hicieras un ejemplo autocontenido y lo pusieras en este foro, para ver de ver si alguien le puede echar un buen ojo.
Mas tarde podr铆a convenir hacer otro ejemplo autocontenido y colocarlo en el foro de Harbour (sin fwh)

Salu2

Continue the discussion