Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outputting an Excel Report in PDF
Message
 
 
To
04/01/2007 16:58:44
Hong Yew
People Quest
Malaysia
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01182547
Message ID:
01183016
Views:
14
>Hi all
>
>My VFP application prepares a Cross Tab and Graph report in Excel through OLE automation. I need some advice on how do I create and email a PDF report generated from the Excel sheet from within my VFP application.
>
>Your advice much appreciated. Thanks
>
>Best Regards

See ACTIVEPRINTER and PRINTOUT at bottom

As for sending the file email - make it an attachment is simple.
For creating your PDF or HTML send output to driver and rename the output appropriatly...
      .ActiveWorkBook.WorkSheets(m.iTabor).Activate
      cDestinationFName= cHTML+ALLTRIM(JUSTSTEM(laFileListWS [ifw,1]))+" "+.ActiveWorkBook.ActiveSheet.Name+'.pdf'
*___ Use for testing                     cDestinationFName= "C:\TEMP\"+ALLTRIM(JUSTSTEM(laFileListWS [ifw,1]))+" "+.ActiveWorkBook.ActiveSheet.Name+'.pdf'
*___ Individual PC's may have different PORT designations - Run Excel Macro to determine PORT
*    The result of printing to PDF995 is \\koshfp01\KChart\HTML\HTML_PDF.pdf (pdf995edit.exe)
*    Delay required for PDF generation and Delete    PARAMETERS lNotPrintedFlag, nPort
              FOR nTryPort = 0 TO 20
               IF FindPortAndPrint(.T.,nTryPort) && NotPrinted=T & Port=0 Ret= T/F 
                      EXIT
                    ENDIF 
                     ENDFOR && Exit after excessive attempts
                     ON ERROR DO LEAVEIT With Message( )
                     DO WaitingForCompletePDF
*...
Function FindPortAndPrint && Try Ne00: thru Ne20:
   PARAMETERS lPrintedFlag, nPort
   ON ERROR Do ForceBlank 
   IF nPort > 20 
      gLogMESS= "* PDF995 Printer Port canNOT be FOUND (This cannot happen)! "
      DO WriteLog
      RETURN .T.
   ENDIF 
   cPort= "Ne"+PADL(nPort,2,"0")+":"
   gLogMESS= "  TRY Port Selection: "+ cPort
   Do WriteLog
   ON ERROR Return .F. && Try Again
   .ActivePrinter = "PDF995 on "+cPort
   IF lPrintedFlag
      .ActiveWorkbook.WorkSheets(m.iTabor).PrintOut && Creates cOriginalFName
      RETURN .T. && Print only once
   ENDIF 
RETURN .F.
Edgar L. Bolton, B.S. B.B.A.
Previous
Reply
Map
View

Click here to load this message in the networking platform