【发布时间】:2015-07-31 10:51:29
【问题描述】:
我正在尝试通过邮件将 PDF 作为附件发送,但我正在努力找出应该是什么路径。我学会了以 PDF 格式导出 Crystal Report,但我不知道如何在附件中给出路径:
这就是我导出 PDF 的方式
Dim rptDocument As ReportDocument = New ReportDocument()
rptDocument.Load(mReportPath)
Dim exportOpts As ExportOptions = New ExportOptions()
Dim pdfOpts As PdfRtfWordFormatOptions = ExportOptions.CreatePdfRtfWordFormatOptions()
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat
exportOpts.ExportFormatOptions = pdfOpts
rptDocument.ExportToHttpResponse(exportOpts, Response, True, "")
这是通过电子邮件发送 pdf 的代码:
Dim msg As New MailMessage()
msg.From = New MailAddress("proccoinvoice@gmail.com")
msg.[To].Add(recipient)
msg.Subject = "Procco Invoice"
msg.Body = "Invoice attached"
msg.Attachments.Add(New Attachment(filepath)) //Path should be given here
Dim client As New SmtpClient("smtp.gmail.com")
client.Port = 25
client.Credentials = New NetworkCredential("proccoinvoice@gmail.com", "<Procco>;1947")
client.EnableSsl = True
client.Send(msg)
我的问题是如何在附件中给出运行时生成的 PDF 的路径?
【问题讨论】:
-
是windows app还是web app?
标签: vb.net email crystal-reports export-to-pdf