Email report without "Save file" dialog

Stimulsoft Ultimate discussion
Post Reply
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

Email report without "Save file" dialog

Post 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
Last edited by tpontow on Fri Nov 30, 2012 8:53 am, edited 1 time in total.
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Email report without "Save file" dialog

Post 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.
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

Re: Email report without "Save file" dialog

Post 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
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Email report without "Save file" dialog

Post by Alex K. »

Hello,

Ok.
Let us know if you need any additional help.

Thank you.
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

Re: Email report without "Save file" dialog

Post 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
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Email report without "Save file" dialog

Post by Alex K. »

Hello,

Let us know if you need any additional help.

Thank you.
Post Reply