[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


powerbuilder 11.5 and crystal report XI  Release 2 Export to PDF dynamically

Posted on 2011-10-09
Medium Priority
Last Modified: 2013-12-26
i am using powerbuilder 11.5 and crystal report 11.5 RC2 i want to export crystal report to PDF automatically to designated folder and email it after saving it in hard disk
 can you help me with a solution

i have attached the code which i am using currently, but it shows the preview and then user has to manually export the report in PDF, attached in email and then send. This method is very time consuming if there are 100's of report to be mailed daily

please help me export report in PDF automatically and save it in hard drive so that i can attached it in mail dynamically
instanse variable
//valriable for crystal report
OLEObject i_ole_crx_application     		// application object
OLEObject i_ole_crx_report					// report object
OLEObject i_ole_crx_connection_info		// database connection properties
OLEObject i_ole_crx_export_options			// export options

//open event

i_ole_crx_application = CREATE OLEObject
// connect to craxdrt.Application
ii_return = i_ole_crx_application.ConnectToNewObject('CrystalRuntime.Application')

i_ole_crx_report = i_ole_crx_application.OpenReport(gs_rpt_filepath+ls_reportname)

i_ole_crx_connection_info = i_ole_crx_report.database.tables[1].ConnectionProperties
ls_dsn = ProfileString(gs_ini_file, "reportpath", "DSN", "AccEasy")
i_ole_crx_connection_info.add("DSN", ls_dsn)

// pass report to the viewer
// Set viewer properties

ole_crviewer.object.DisplayToolbar = TRUE
ole_crviewer.object.EnableAnimationCtrl = TRUE
ole_crviewer.object.EnableDrillDown = TRUE
ole_crviewer.object.EnableExportButton = TRUE
ole_crviewer.object.EnableGroupTree = TRUE
//ole_crviewer.object.EnableInteractiveParameterPrompting = TRUE
ole_crviewer.object.EnableNavigationControls = TRUE

ole_crviewer.object.EnablePopupMenu = TRUE
ole_crviewer.object.EnablePrintButton = TRUE
ole_crviewer.object.EnableProgressControl = TRUE
ole_crviewer.object.EnableRefreshButton = TRUE
ole_crviewer.object.EnableSearchControl = TRUE
ole_crviewer.object.EnableSearchExpertButton = TRUE
ole_crviewer.object.EnableSelectExpertButton = TRUE
ole_crviewer.object.EnableStopButton = TRUE
ole_crviewer.object.EnableToolbar = TRUE


ole_crviewer.object.EnablePrintButton = TRUE
ole_crviewer.object.EnableGroupTree = false
ole_crviewer.object.EnableExportButton = TRUE
// view report

Open in new window

Question by:rajinfosys
  • 2
  • 2
LVL 101

Expert Comment

ID: 36953039
DO you have a MAPI mail server?
If so you can export the report directly to MAPI nad specify the attachment format as PDF.


Author Comment

ID: 36954182
can you provide any code sample for it
LVL 101

Accepted Solution

mlmcc earned 1000 total points
ID: 36966297
Here is the code we used.
The reort is exported to a PDF then the email is sent with the attachment

crRpt.ExportOptions.DestinationType = crEDTDiskFile
    crRpt.ExportOptions.DiskFileName = txtAttachmentFile
    crRpt.ExportOptions.FormatType = crEFTPortableDocumentFile
    crRpt.Export False

' Handle mail addresses when they exist
    rAddress(0) = txtMailAddress
    If (txtMailAddress = "") Then
      rCount = 0
      rCount = 1
    End If
    ccAddress(0) = ""
    ccCount = 0
    Attch(0) = txtAttachmentFile
    aCount = 1
    sessDisplay = True
    frmEmail.SendMessage rAddress, ccAddress, txtMailSubject, txtMailMessage, _
                                            Attch, sessDisplay, rCount, ccCount, aCount

    Set crRpt = Nothing

Open in new window


Author Closing Comment

ID: 36966792
i am able to export the report to pdf but for email powerbuilder does not have this method

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question