将水晶报告导出为PDF并通过电子邮件作为附件发送 - 文件名问题?
我需要将水晶报告导出为pdf并通过电子邮件发送出去。我创建了一个有效的子程序,但附加的文件名出现为"untitled.txt"。所以接收机器认为它是一个文本文件。如果我在收件人计算机上将其重命名为".pdf"。我可以用acrobat打开它,它看起来不错。有人知道如何在发送文件之前将文件重命名为pdf吗?
I need to export a crystal report as a pdf and send it out via email. I have created a subroutine that works but the attached filename come up as "untitled.txt" so the receiving machine believes it is a text file. If I rename it on the recipients machine to a ".pdf" I can open it with acrobat and it looks OK. Does anyone know how to rename the file as a pdf prior to sending it out?
谢谢。
al
我已经包含了子程序的副本:
I have included a copy of the subroutine:
Dim repdoc As 新 CrystalDecisions.CrystalReports.Engine.ReportDocument()
Dim repdoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
Dim diskOpts As 新 CrystalDecisions.Shared.DiskFileDestinationOptions()
Dim diskOpts As New CrystalDecisions.Shared.DiskFileDestinationOptions()
Dim ExpOpts As CrystalDecisions.Shared.ExportOptions
Dim ExpOpts As CrystalDecisions.Shared.ExportOptions
Dim MailOpts As 新 CrystalDecisions.Shared.MicrosoftMailDestinationOptions()
Dim MailOpts As New CrystalDecisions.Shared.MicrosoftMailDestinationOptions()
repdoc = Me .CrystalReport11
repdoc = Me.CrystalReport11
repdoc.Load( " C:\Documents and Settings \User\My Documents\Visual Studio 2005 \Projects \ WindowsApplication3 \ WindowsApplication3 \CrystalReport1.rpt" )
repdoc.Load("C:\Documents and Settings\User\My Documents\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplication3\CrystalReport1.rpt")
ExpOpts = repdoc.ExportOptions
ExpOpts = repdoc.ExportOptions
使用 ExpOpts
With ExpOpts
.ExportDestinationType = CrystalDecisions。[Shared] .ExportDestinationType.MicrosoftMail
.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.MicrosoftMail
.ExportFormatType = CrystalDecisions。[Shared] .ExportFormatType。 PortableDocFormat
.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
结束 使用
End With
使用 MailOpts
With MailOpts
.MailMessage = " ;消息"
.MailMessage = "Message"
.MailToList = "在此处输入电子邮件地址"
.MailToList = "enter email adress here"
.MailSubject = "附件是PDF文件 - .net导出测试"
.MailSubject = "Attached is a PDF file - .net Export test "
结束 使用
End With
ExpOpts.DestinationOptions = MailOpts
ExpOpts.DestinationOptions = MailOpts
尝试
Try
repdoc.Export()
repdoc.Export()
Catch 错误 As 异常
Catch err As Exception
MessageBox.Show(err.ToString())
MessageBox.Show(err.ToString())
结束 尝试
End Try
结束 Sub
End Sub
我有同样的,未解决的,问题。您找到了解决方案吗?
I have the same, unresolved, problem. Did you find any solutions?
Tnx,Andrea。
Tnx, Andrea.