Page 1 of 1
Email report without "Save file" dialog
Posted: Mon Nov 26, 2012 12:39 pm
by tpontow
Hello,
is it possible to send a report via email as attachement without getting the "Save file" dialog?
It is ok for me to choose the export format for the mail attachement, but then i'd like to save the exported report in the system temp path (override it if it still exists) and use this temp path document as attachement for the email. This is because i don't want the user to choose his own export path and don't want him to decide if existing files should be overriden or not. By this the user has at least two clicks and dialogs fewer if he wants to send a report by email.
Thanks
Thorsten Pontow
Re: Email report without "Save file" dialog
Posted: Mon Nov 26, 2012 1:19 pm
by Alex K.
Hello,
As a way, you can try to subscribe on the StiOptions.Engine.GlobalEvents.SendEMailProcess event and try to realize your method for sent email.
Thank you.
Re: Email report without "Save file" dialog
Posted: Mon Nov 26, 2012 1:22 pm
by tpontow
Hello Aleksey,
thanks for your quick response. I will try it the way you suggested and then i will come back to you.
Thanks
Thorsten
Re: Email report without "Save file" dialog
Posted: Mon Nov 26, 2012 1:48 pm
by Alex K.
Hello,
Ok.
Let us know if you need any additional help.
Thank you.
Re: Email report without "Save file" dialog
Posted: Tue Nov 27, 2012 11:09 am
by tpontow
Hello Aleksey,
unfortunately the SendEMailProcess event fires after the "Save file" dialog and that is too late. But with that event it is possible for me to change Subject and Body of the created email, which i needed too.
Code: Select all
//Lamdba expresssion is used here...
StiOptions.Engine.GlobalEvents.SendEMailProcess += (sender, args) =>
{
args.Subject = "Ihr Report";
args.Body = "Fügen Sie hier Ihre Nachricht ein.";
};
I solved my problem in another way. Here in our framework we have our own viewer window in which the StiViewerControl is one part of. We don't show the toolbar of the viewer but have our own custom menus. So we have menu items for sending reports as email. With that i can call the Export() method of the regarding ExportService in my own code and set my own file name. With that no save file dialog is displayed.
For example pdf email goes like this:
Code: Select all
string myFileName = Path.Combine(Path.GetTempPath(), "Report.pdf");
StiPdfExportService stiPdfExportService = new StiPdfExportService();
stiPdfExportService.Export(Report, myFileName, sendEMail:true);
So thanks for your help. Your post put me on the right track!
Thorsten
Re: Email report without "Save file" dialog
Posted: Wed Nov 28, 2012 6:03 am
by Alex K.
Hello,
Let us know if you need any additional help.
Thank you.