Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help automating Excel printout to PDF from within FoxPro
Message
 
À
01/02/2005 00:17:50
Nate Hastings
Ripon Community Printers
Ripon, Wisconsin, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 8
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
00982586
Message ID:
00982649
Vues:
33
Nate,
This link might help you along the way.
http://www.cutepdf.com/Solutions/pdfwriter2.asp

It is important to understand that CutePDF acts as a printer, i.e. Windows thinks there is a printer attached that is called CutePDF Printer and it sends the data to the printer driver as if it was a physical printer. The 6th parameter (PrintToFile) of the PrintOut() method will print to a printer file (binary file), and even if the file has the .pdf extension it is not a PDF file. So what you want to do is look into how to automate the filename in CutePDF.

Hope the link helps.

Einar



>I am using an OLE container control to automate an Excel spreadsheet. We create and manipulate data in Excel in our quoting process.
>
>I am trying to pull up the finished cover letter, create a pdf file and email it back to the creator so it can be forwarded to the customer. Everything works great if the filename is allowed to be entered manually but when it is automated (either through FoxPro or as a macro from within Excel) the resulting pdf file created cannot be opened in Acrobat Reader. I get an error that reads "Adobe Reader could not open "filename.pdf" because it is either not a supported file type or because the file has been corrupted (for example, it was sent as an email attachment and wasn't correctly decoded)."
>
>Here's the jist of the code to get the file into excel and prepare to print. I then use CutePDF as the print driver for output which is saved to the local c: drive.
>
>loExcel = CreateObject("Excel.Application")
>loExcel.DisplayAlerts = .F.
>loExcel.Workbooks.Open(lcPathName2)
>loExcel.Range("B1:I77").Select
>
>WITH loExcel.ActiveSheet.PageSetup
> .LeftHeader = ""
> .CenterHeader = ""
> .RightHeader = ""
> .TopMargin = 0
> .HeaderMargin = 0
> .PrintArea="B1:I77"
> .PrintHeadings = .F.
>ENDWITH
>
>*loExcel.Run("nateprint1") && this is what I tried to use to run the printing through a macro located in the excel file
>
>loExcel.ActiveSheet.PrintOut(1,1,1,.F.,"CutePDF Printer",.T.,.T.,"C:\"+ALLTRIM(mquotenum)+".pdf") && this is how I would like to be able to enter the filename automatically without user intervention.
>
>*loExcel.ActiveSheet.PrintOut(1,1,1,.F.,"CutePDF Printer",.F.,.T.) && this is the line I've used that works but requires the user to enter the file name in the dialog box that displays after printing.
>
>I've tried different combinations to no avail. I would appreciate any guidance on this.
>
>Thanks in advance,
>Nate
Semper ubi sub ubi.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform