Results 1 to 3 of 3

Thread: Sendig Crystal Report through mail

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    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

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    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
  •  



Click Here to Expand Forum to Full Width