Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Export Fairly Complex Report to PDF or Word Document
Message
 
 
To
11/07/2000 15:22:53
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00390904
Message ID:
00390927
Views:
9
>Hi all..
>
>
>Is there a was to export a fairly complex report to PDF or Word format instead of printing?
>
>
>Thanks
>Carl

If you have PDF Writer installed on your machine, you can run this program just before REPORT FORM myReport TO PRINTER NOCONSOLE.
*******************************************************************************
*  Description.......: CreatePDF - creates PDF for specified filename
*  Calling Samples...: CreatePDF('c:\temp\temp.pdf')
*  Parameter List....: pcFileName
*  Created by........: Houston Brennan 06/12/2000
*  Modified by.......: Nadya Nosonovsky 06/16/2000 10:56:51 AM
******************************************************************************
lparameters pcFileName
if empty(pcFileName)
     pcFileName='c:\windows\temp\tempfile.pdf'
endif

local cPDFFile, lcOldSafety, iInitialise, iIsNT, ;
     cPdfWriter, cPort, iInstalled, iDoPrompt, iSetFileName

lcOldSafety=set('safety')
cPdfDLLFile = "c:\Program Files\Adobe\Acrobat 4.0\Macros\Office95\PDFMon.DLL"

if not file(cPdfDLLFile )
     wait window nowait "Required Acrobat Writter DLL is not present on your local drive" +;
          chr(13)+"Will print to default printer..."
     return .t.
endif

clear dlls
declare integer PDFMonInitialize in (cPdfDLLFile)
declare integer PDFMonIsOSNT in (cPdfDLLFile)
declare integer IsPDFWriterInstalled in (cPdfDLLFile) ;
     string@ cPDFWriterName , ;
     string@ cPort
declare integer PDFMonDoPrompt in (cPdfDLLFile) ;
     integer iWhichProgram

declare integer PDFMonSetPrompt in (cPdfDLLFile) ;
     integer iWhichProgram , ;
     integer iNewValue

#define SETPROMPTOFF 0
#define SETPROMPTON 1

declare integer PDFMonSetOutputFilename in (cPdfDLLFile) ;
     string cFileName
declare integer PDFMonCleanup in (cPdfDLLFile)

iInitialise = PDFMonInitialize()
*? "Initialise : "
*?? iInitialise

iIsNT = PDFMonIsOSNT()
*? "Is NT : "
*?? iIsNT
set safety off
cPdfWriter = space(100)
cPort = space(100)
iInstalled = IsPDFWriterInstalled( @cPdfWriter, @cPort )
if iInstalled=1 && PDF Writer is installed
     set printer to name 'Acrobat PDFWriter'
endif
*? "Installed "
*?? iInstalled
*? "PDF Writer : "
*?? cPdfWriter
*? "Port : "
*?? cPort
*?

iDoPrompt = PDFMonDoPrompt( SETPROMPTOFF )
*? iDoPrompt
*cFileName = "c:\Temp\Test.Pdf"
iSetFileName = PDFMonSetOutputFilename(pcFileName)
*? iSetFileName
*!*     pcFileName = ""
*!*     iSetFileName = PDFMonSetOutputFilename(pcFileName)
*!*     ? iSetFileName

*? PDFMonCleanup()
clear dlls
set safety &lcOldSafety
*? "Finished."
return .t.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform