简体   繁体   中英

Send reports from Windows Service application

I have to send a Reporting Services Report report (or crystal report) periodically every N minutes via email.

I don't have the SQL Reporting Server, it is a stand-alone application. They want to receive the reports in their inbox as a PDF or XLS file.

How I could do that using a console app or a Windows service app ? Is that possible?

I assume that you can generate reports. Or else if you wish to create reports in xls format, without using the MS SQL Reporting services or Crystal report, you can get it done using Microsoft.Office.Interop.Excel dll. You may configure a physical path (in your app.config file) where the generated reports are saved. In your windows service you can send emails in a time interval. You can select the xls file (report) which you have already created, send it along with the email as an attachment. For that you can use the System.Net.Mail.SmtpClient class. (For more details - http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx )

When you are creating the email message you may configure the smtp server, from and to addresses and the time interval of the windows service in your App.config file as preferred. Hope this helps.

PS I have got the sample code of creating a xls files using Microsoft.Office.Interop.Excel assembly. If you need I would like to share.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM