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

Posted on 2011-10-09
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
    LVL 100

    Expert Comment

    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

    can you provide any code sample for it
    LVL 100

    Accepted Solution

    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

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    A short article about a problem I had getting the GPS LocationListener working.
    If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now