Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

export code for Crystal

Status
Not open for further replies.

DanNorris2000

Technical User
Nov 10, 2000
186
US
I would like to export a crystal report to a folder using vfp6.0 from VFP application to a pdf file.
can it be done within this code?

oCRApp = createobject("crystal.crpe.application")
oRep = oCRApp.openreport("k:\vfp\reinsurance\reports\31pf.rpt")
oRep.Printout(.F.)

oCRApp = createobject("crystal.crpe.application")
oRep = oCRApp.openreport("k:\vfp\reinsurance\reports\41pf.rpt")
oRep.Printout(.F.)
 
DanNorris2000

I don't see the in your code the "translation" to pdf. You would need to use either Acrobat or some sort of engine to achieve the final result. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
If I call up a crystal report from within Crystal8.5 I can take the export option to PDF. I am just trying to figure out how to add additional code to the above in order to automate that process. I would like to print and send a pdf copy to a folder in order to archive
 

Try:

oCRApp = createobject("crystal.crpe.application")
oRep = oCRApp.openreport("k:\vfp\reinsurance\reports\41pf.rpt")
oRep.Printout(.F.)
oRep.Export()

Althought the above will prompt you.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
That works but it does prompt. Any way to automatically export to a folder? Where can I find valid parameter for oRep.Export()
 
Found the following for export to Excel
anyone familiar with the format type codes and what it would be for PDF?

0Exp.FormatType = 27 (?type for PDF?)
oExp.DiskFileName = "C:\Temp\Taz.XLS"
oRpt.Export(.F.)
 
Dan,

There are two ways of exporting a report in Crystal to PDF. The first is the Export method, which you have found. The other (easier, in my opinion) is to "print" it to a PDF printer driver.

Either way, you will need additional software installed to create the PDF. Crystal cannot do that natively. However, you don't need to buy the full Acrobat product. There are plenty of low-cost printer drivers and DLLs around.

Here's how I would do it:

loCR = CREATEOBJECT("crystalRuntime.Application")
loRep = loCR.OpenReport("MySuperReport.RPT")
loRep.SelectPrinter("PDF Driver") && substute actual name of driver
loRep.Printout(.F.)

With the above code, Crystal will not display any kind of dialogue to the user, but the printer driver might. You should be able to avoid the printer driver's dialogue by setting the destination file programmatically. How you do that will depend on the driver.

Let me know if this helps.



Mike Lewis
Edinburgh, Scotland
 
From CrystalDecisions:

in Crystal Reports 8.5 you can export to PDF using the RDC.

For example, the following Visual Basic code exports a report to PDF:

Dim appl As New CRAXDRT.Application
Dim rep As CRAXDRT.Report

Private Sub Command1_Click()

Set rep = appl.OpenReport("c:\mytest.rpt", 1)
rep.ExportOptions.DiskFileName = "c:\pdf_report.pdf"
rep.ExportOptions.DestinationType = crEDTDiskFile
rep.ExportOptions.FormatType = crEFTPortableDocFormat
rep.Export False

End Sub

Note: ======

To export successfully to PDF, the exportmodeller.dll and crtslv.dll files must be present on the computer and must be registered. For more information, refer to kbases c2009297 and c2009165.

I will test and get back to everyone
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top