limiting the possible save options

Stimulsoft Reports.NET discussion
Post Reply
remkop
Posts: 3
Joined: Wed Sep 09, 2009 10:10 am

limiting the possible save options

Post by remkop »

We show a report via an C# application. There are to many options to save the report in, so we want to limit this.
I could find something ablout a configuration file. So I have done something like this

Code: Select all

StiConfig.Load("..\\..\\report_config.Config");

StiServiceContainer Services = (StiServiceContainer)StiConfig.Services.GetServices(typeof(StiExportService));
foreach (StiService Service in Services)
{
	if (Service is StiPdfExportService)
	{
		Service.ServiceEnabled = false;
	}
}
StiConfig.Save();
For some raeson it's is still possible to save the report as an PDF. I think this has to do with the fact that our mrt-file isn't connected to the cofiguration file. I have no idea how to do this and/or this is the rhight way to limit the save options ...

So if anyone has thoughts about this, please provide some feedback.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

limiting the possible save options

Post by Jan »

Hello,

You can use following code:

Code: Select all

StiOptions.Viewer.Windows.Exports.ShowPdf = false;
StiOptions.Viewer.Windows.Exports.ShowXps = false;
StiOptions.Viewer.Windows.Exports.ShowExcel = false;
Thank you.
remkop
Posts: 3
Joined: Wed Sep 09, 2009 10:10 am

limiting the possible save options

Post by remkop »

Thanks for the answer.

Where should i put these lines??
Because this isn't working

Code: Select all

Report.Load("..\\..\\CustomPreview.mrt");
Report.Compile();

Report.Render(false);
StiOptions.Viewer.Windows.Exports.ShowPdf = false;
StiOptions.Viewer.Windows.Exports.ShowXps = false;
StiOptions.Viewer.Windows.Exports.ShowExcel = false;
PreviewControl.Refresh();
remkop
Posts: 3
Joined: Wed Sep 09, 2009 10:10 am

limiting the possible save options

Post by remkop »

I found out that I should place this in the template.
But are there also options to arange this from the calling application??
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

limiting the possible save options

Post by Edward »

Hi

Please place this code in a very beginning of your application, i.e. in program.cs, when none of the report objects have been created.

Thank you.
Post Reply