将水晶报告导出为PDF并通过电子邮件作为附件发送 - 文件名问题? [英] Exporting crystal report as PDF and sending via email as attachment - Filename Issue?

查看:139
本文介绍了将水晶报告导出为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 < font size = 2> 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.


这篇关于将水晶报告导出为PDF并通过电子邮件作为附件发送 - 文件名问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆