Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Running a VFP Report using OLE Automation
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00793735
Message ID:
00793905
Vues:
21
Did you try to run it from within VFP as a VFP class?

>I thought I had the problem of running the VFP REPORT command inside an OLE EXE figured out. When I call the method from inside the EXE, I can see an open dialog popup on the task bar when it runs the REPORT command. The program hangs until I "end task" the open dialog.
>
>I am trying to send the ouput to the Acrobat PDFWriter. Even when I try to just send the report to a file with select the PDFWriter printer, it does the same thing. Below is the code that I use. I read the document http://www.west-wind.com/presentations/pdfwriter/pdfwriter.htm at West Wind and followed the code. If someone could help me, I would really be grateful!
>
>Tim
>
>* Program to call OLE EXE to create PDF
>
>x = CREATEOBJECT("InsbShared.VfpReport")
>lcSf135 = x.ReportRun("C:\Development\Vfp\Public\Reports\Sf135.frx", "Acrobat PDFWriter")
>x = .null.
>
>* Class definition for OLE EXE
>DEFINE CLASS vfpreport AS custom OLEPUBLIC
>	Name = "vfpreport"
>	*-- To run a VFP report and send the output to a text file
>	PROCEDURE reportrun
>		* Purpose: To run a VFP report and send the output to a PDF file
>		*
>		* Parameters:
>		*   tcReportFrx:  VFP report
>		*   tcPdfPrinter: PDF printer name
>		*
>		* Return: PDF file
>
>		LPARAMETERS tcReportFrx, tcPdfPrinter
>		LOCAL lcOldCentury, lcOldDefault, lcOldPrinter, lcReportPdf, lcReportPs
>
>		* Initial settings
>
>		lcOldCentury = SET("Century")                    && Save Century setting
>		lcOldDefault = FULLPATH("")                      && Save default directory
>		lcOldPrinter = SET("Printer", 3)                 && Save current printer
>		SET CENTURY ON                                   && Display four-digit year
>		SET DEFAULT TO (SYS(2023))                       && Go to temporary directory
>		SET PRINTER TO NAME (tcPdfPrinter)               && Set PDF printer
>		lcReportPdf = SUBSTR(SYS(2015), 3, 10)           && File name for report output
>		lcReportPs = lcReportPdf + ".ps"                 && Text file for report output
>		lcReportPdf = FULLPATH(lcReportPdf + ".pdf")     && PDF file for report output
>
>		* Run report
>
>		IF FILE(lcReportPs)                              && If text file exists...
>		  DELETE FILE (lcReportPs)                       && Delete text file
>		ENDIF
>
>		IF FILE(tcReportFrx)                             && If report does exist...
>		  REPORT FORM (tcReportFrx) TO FILE (lcReportPs) NOCONSOLE && Run report and send output to text file
>		  IF FILE(lcReportPs)                            && If text file exists...
>		    DELETE FILE (lcReportPs)                     && Delete text file
>		  ENDIF
>		ENDIF
>
>		* Restore settings
>
>		SET CENTURY OFF                                  && Restore Century setting
>		SET DEFAULT TO (lcOldDefault)                    && Restore default directory
>		SET PRINTER TO NAME (lcOldPrinter)               && Restore current printer
>
>		RETURN lcReportPdf
>	ENDPROC
>ENDDEFINE
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform