通过电子邮件发送水晶报表 [英] Emailing Crystal Report
本文介绍了通过电子邮件发送水晶报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在使用C#,Crystal报表填充报表,并使用Reportviewer来显示报表.
现在,我需要知道如何通过电子邮件发送在报告查看器中生成的报告.
我在google中搜索了相同的内容,但在需要报表文件物理路径的地方找到了所有代码.但是我已经将它们添加到项目中并使用了水晶报表的名称.
让我知道您是否不清楚.
Hello All,
I am using C# , crystal report to populate the report and Reportviewer to show the report.
Now I need to know how to email that report which is generated on report viewer.
I searched the same in google but I found all code where it need physical path of report file. but I have added them into project and used name of crystal report.
Let me know if this is unclear to you.
推荐答案
这实际上很容易,具体取决于您使用的Crystal版本.
您需要 ReportDocument [ ExportToStream [流 [附件 [ MailMessage [ ^ ]和SmtpClient [
This is actually pretty easy, depending on the version of Crystal you use.
You need a ReportDocument[^] (which you probably have if you have a viewer) and use the ExportToStream[^] function.
Now simply pass the Stream[^] to the constructor of an Attachment[^].
Other than that you can simply use the MailMessage[^] and SmtpClient[^] like you would for any other mail.
Using this method does not require you to save the report to disk (not even temporarily).
Hope it helps!
这篇关于通过电子邮件发送水晶报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文