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

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
i_ole_crx_connection_info.deleteAll
ls_dsn = ProfileString(gs_ini_file, "reportpath", "DSN", "AccEasy")
i_ole_crx_connection_info.add("DSN", ls_dsn)

// pass report to the viewer
ole_crviewer.object.ReportSource(i_ole_crx_report)
// 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
//ole_crviewer.object.Zoom(100)
// view report
ole_crviewer.object.ViewReport()
ole_crviewer.object.Refresh()

Open in new window

rajinfosysAsked:
Who is Participating?
 
mlmccCommented:
Here is the code we used.
The reort is exported to a PDF then the email is sent with the attachment

mlmcc
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
    Else
      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

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

mlmcc
0
 
rajinfosysAuthor Commented:
can you provide any code sample for it
0
 
rajinfosysAuthor Commented:
i am able to export the report to pdf but for email powerbuilder does not have this method
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.