redheadpgr
Programmer
I'm using the following code to create a PDF file from a Crystal Report.
This method works fine but I'm wondering if there is any way I can bypass exporting the file to disk? I still need to have the pdf file as an attachment.
Thanks.
Code:
Dim oRpt As New CrystalReport1
Dim DiskOpts As CrystalDecisions.Shared.DiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
oRpt.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
oRpt.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
filepath = "c:\crystal\report.pdf"
DiskOpts.DiskFileName = filepath
oRpt.ExportOptions.DestinationOptions = DiskOpts
oRpt.Export()
dim myMessage as New MailMessage
myMessage.To = "SomeEmail@somecompany.com"
myMessage.From = "Me@mycompany.com"
myMessage.Body = "See attached file"
myMessage.Attachments.Add(New MailAttachment(filepath, MailEncoding.UUEncode)
SmtpMail.SmtpServer = "myEmailServer"
SmtpMail.Send(myMessage)
This method works fine but I'm wondering if there is any way I can bypass exporting the file to disk? I still need to have the pdf file as an attachment.
Thanks.