|
-
May 5th, 2009, 08:01 AM
#1
Thread Starter
Hyperactive Member
Sendig Crystal Report through mail
Hi,
using this code i am able to send the viewed report to any given email id in pdf format but attachement "untitled.txt"
at the end change the extension to .pdf and view the report.
But i want instead of "untitled.txt" attachement should be "report.pdf"
pls guide how can i achive the same.
Code:
Private Sub cmdEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEmail.Click
Dim ExportOptions As New CrystalDecisions.Shared.ExportOptions
Dim EMailOptions As New CrystalDecisions.Shared.MicrosoftMailDestinationOptions
Try
ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat
ExportOptions.ExportDestinationType = ExportDestinationType.MicrosoftMail
EMailOptions.MailToList = txtEmail.Text
EMailOptions.MailSubject = "Online Report"
EMailOptions.MailMessage = "Report..."
ExportOptions.ExportDestinationOptions = EMailOptions
CrReport.Export(ExportOptions)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
-
May 5th, 2009, 08:22 AM
#2
Re: Sendig Crystal Report through mail
How about renaming the file after it is created?
Code:
Private Sub cmdEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEmail.Click
Dim ExportOptions As New CrystalDecisions.Shared.ExportOptions
Dim EMailOptions As New CrystalDecisions.Shared.MicrosoftMailDestinationOptions
Try
ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat
ExportOptions.ExportDestinationType = ExportDestinationType.MicrosoftMail
'assuming it gets created with the above line. If not, then move these
'two lines as appropriate (and, of course, make sure the path
'is correct
Dim myFile As New System.IO.FileInfo("c:\untitled.txt")
myFile.MoveTo("c:\report.pdf")
EMailOptions.MailToList = txtEmail.Text
EMailOptions.MailSubject = "Online Report"
EMailOptions.MailMessage = "Report..."
ExportOptions.ExportDestinationOptions = EMailOptions
CrReport.Export(ExportOptions)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
-
May 6th, 2009, 06:19 AM
#3
Thread Starter
Hyperactive Member
Re: Sendig Crystal Report through mail
message :
unable to find the specified file
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|