Wrox Programmer Forums
|
BOOK: Wrox's Visual Basic 2005 Express Edition Starter Kit ISBN: 978-0-7645-9573-8
This is the forum to discuss the Wrox book Wrox's Visual Basic 2005 Express Edition Starter Kit by Andrew Parsons; ISBN: 9780764595738
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Wrox's Visual Basic 2005 Express Edition Starter Kit ISBN: 978-0-7645-9573-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 30th, 2008, 07:19 AM
Registered User
 
Join Date: Jan 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Mail Crystal Report from VB.Net 2005

Hi,

  I have been trying to email a report in word or pdf format using MAPI service. Following is my code:

Dim mail As MicrosoftMailDestinationOptions = ExportOptions.CreateMicrosoftMailDestinationOption s
            Dim exOptions As ExportOptions = New ExportOptions

            mail.MailToList = Trim(utxtTo.Text)
            mail.MailCCList = Trim(utxtCC.Text)
            mail.MailSubject = Trim(utxtSubject.Text)
            mail.MailMessage = Trim(utxtMessage.Text)

            exOptions.ExportDestinationType = ExportDestinationType.MicrosoftMail
            exOptions.ExportDestinationOptions = mail
            If strType = "Word" Then
                exOptions.ExportFormatType = ExportFormatType.WordForWindows

            ElseIf strType = "PDF" Then
                exOptions.ExportFormatType = ExportFormatType.PortableDocFormat
            End If
            exOptions.ExportFormatOptions = New PdfRtfWordFormatOptions
            crxRpt.Export(exOptions)

=================================
the problem i am facing is that it is sending the mail in outlook's outbox with the email, subject and message all correct, but the word or pdf file is not attached with the mail. some Untitled.txt file is seen as attachment.

What could be reason? Plz give some solution for this.

(: SachinBhalerao :)
 
Old April 14th, 2008, 12:09 PM
Registered User
 
Join Date: Apr 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

first thing you hav to do is to export the crystal report as PDF formt in specific location

            Dim CrExportOptions As ExportOptions
            Dim CrDiskFileDestinationOptions As New _
            DiskFileDestinationOptions()
            Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions
            CrDiskFileDestinationOptions.DiskFileName = pdfFile
            CrExportOptions = cryRpt.ExportOptions
            With CrExportOptions
                .ExportDestinationType = ExportDestinationType.DiskFile
                .ExportFormatType = ExportFormatType.PortableDocFormat
                .DestinationOptions = CrDiskFileDestinationOptions
                .FormatOptions = CrFormatTypeOptions
            End With
            cryRpt.Export()


after you export , email the pdf from the specific location

            Dim Smtp As SmtpMail
            SmtpMail.SmtpServer.Insert(0, "your hostname")
            Dim Msg As MailMessage = New MailMessage
            Msg.To = "to address here"
            Msg.From = "from address here"
            Msg.Subject = "Crystal Report Attachment "
            Msg.Body = "Crystal Report Attachment "
            Msg.Attachments.Add(New MailAttachment(pdfFile))
            Smtp.Send(Msg)


i found this code from a website , if yo need more information plz refer this link

http://vb.net-informations.com/cryst...port_email.htm

bill






Similar Threads
Thread Thread Starter Forum Replies Last Post
Deploye crystal report with VB.NET 2005 zrtv Crystal Reports 2 June 6th, 2009 08:09 AM
VB 2005 Crystal Report Connection with SQL 2000 blackspear BOOK: Professional Crystal Reports for VS.NET 0 December 3rd, 2008 09:49 AM
simple report and crystal report in vb.net saket123 .NET Framework 2.0 0 August 13th, 2008 06:55 AM
Using Crystal in VB 2005 without Report Viewer csdunaway Crystal Reports 6 July 18th, 2007 11:48 AM
Problem in Crystal Report in VS.NET 2005 SaeedNawazMalik .NET Framework 2.0 1 March 4th, 2006 03:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.