How to set Open after export from runtime

Stimulsoft Reports.WPF discussion
Post Reply
LukasT
Posts: 306
Joined: Mon May 03, 2010 2:50 am
Location: Czech Republic

How to set Open after export from runtime

Post by LukasT »

Hello,
I need to control setting of "Open after export checkbox" from runtime. Please, how to do it?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to set Open after export from runtime

Post by Alex K. »

Hello,

You can use the following code:

Code: Select all

StiSettings.Load();
StiSettings.Set("StiPdfExportSetupForm", "OpenAfterExport", true);
StiSettings.Save();
Thank you.
LukasT
Posts: 306
Joined: Mon May 03, 2010 2:50 am
Location: Czech Republic

Re: How to set Open after export from runtime

Post by LukasT »

Thank you,
but it is not working...

My code:

StiSettings.Load();
StiSettings.Set("StiPdfExportSetupForm", "OpenAfterExport", true);
StiSettings.Save();
StiExportService serv = new StiPdfExportService();
serv.Export(report, file, Stimulsoft.Base.StiGuiMode.Wpf);
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to set Open after export from runtime

Post by Alex K. »

Hello,

Please try to use the following code:

Code: Select all

StiSettings.Load();
StiSettings.Set("StiPdfExportSetupControl", "OpenAfterExport", true);
StiSettings.Save();
Thank you.
LukasT
Posts: 306
Joined: Mon May 03, 2010 2:50 am
Location: Czech Republic

Re: How to set Open after export from runtime

Post by LukasT »

Hello,
I am sorry but this way how to get value of OpenAfterExport property seems to be not stable :-( In new release is path to property different and I need to have some reliable solution how to get value of this property for all export types...
Now I am using this way which is correctly working for all export service types except case of Image or Data export service:

bool oldOpenAfterExportValue = (bool)StiSettings.Get("Sti" + service.ExportFormat.ToString() + "ExportSetupControl", "OpenAfterExport", false);
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to set Open after export from runtime

Post by HighAley »

Hello.

The OpenAfterExport is not connected with export service, but with export dialog. So there is StiDataExportSetupControl but not the StiCsvExportSetupControl, StiDbfExportSetupControl and etc.
The same situation with StiImageExportSetupControl.

There is a difference between WinForms and WPF products.
In WinForms there are StiDataSetupForm and StiImageSetupForm.
And in the WPF there are StiDataGroupExportSetupControl and StiImageGroupExportSetupControl.

As we see from your code you export reports from code and not from viewer. It this case the OpenAfterExport option doesn't work.
Here is a method that we call to open exported report. You could use the same.

Code: Select all

System.Diagnostics.Process.Start(string.Format("\"{0}\"", fileName));
Thank you.
LukasT
Posts: 306
Joined: Mon May 03, 2010 2:50 am
Location: Czech Republic

Re: How to set Open after export from runtime

Post by LukasT »

The right reason why I need access to this property is to set it to false value... I will try StiDataGroupExportSetupControl and StiImageGroupExportSetupControl name...
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to set Open after export from runtime

Post by HighAley »

Hello.

Sorry, maybe we don't exactly understand your message.
Could you describe it more detailed?

Thank you.
LukasT
Posts: 306
Joined: Mon May 03, 2010 2:50 am
Location: Czech Republic

Re: How to set Open after export from runtime

Post by LukasT »

Never mind.... the StiDataGroupExportSetupControl and StiImageGroupExportSetupControl name is working correctly... thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to set Open after export from runtime

Post by HighAley »

Hello.

Let us know if you need any additional help.

Thank you.
Post Reply