Limiting the Export types in a C# Crystal Reports Viewer

Hi all,

    Is there any way you can limit the export types in a Crystal Reports export dialog box ? Ive written a viewer in c#/.Net which works well, but I would like to limit the export options available to the user, say to PDF and XLS....

cheers

Adam
adders99Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mnyeCommented:
static drop down box with the two option, depending on selected value set your exportoption value accordingly.

hth
matt
0
adders99Author Commented:
Sorry, I should have said, Im using the standard Crystal Report component for .net which comes with its own toolbar, export option etc, so Im not actually building a drop down myself.....I was hoping to avoid creating one, just wanted to restrict the existing one.
0
mnyeCommented:
can you post some code, im not too sure what you are using.
thanks
matt
0
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

adders99Author Commented:
Im not sure what I can post as its a standard visual control you paste onto a form. I know I can specify the export type, and export like that, but I need to allow the user to select from a list. So, in the example below, Ive added code behind an 'EXPORT' button to export in Excel format, but Id like the user to choose from a controlled list...

// Declare variables and get the export options.
ExportOptions exportOpts = new ExportOptions();
ExcelFormatOptions excelFormatOpts = new ExcelFormatOptions ();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
exportOpts = ReportInstance.ExportOptions;

// Set the excel format options.
excelFormatOpts.ExcelUseConstantColumnWidth = true;
exportOpts.ExportFormatType = ExportFormatType.Excel;
exportOpts.FormatOptions = excelFormatOpts;

// Set the disk file options and export.
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
diskOpts.DiskFileName = "C:\\temp.xls";
exportOpts.DestinationOptions = diskOpts;

ReportInstance.Export ();
0
mnyeCommented:
Yeah I think you're going to have to create your own dropdown.  I dont see any other way around that.  its pretty simple though.

<asp:dropdownlist id="ddlExport" runat="server"
   <asp:listitem value=1>Excel</asp:listitem>
   <asp:listitem value=2>PDF</asp:listitem>
</asp:dropdownlist>

then set up another routine for the pdf export in your code behind and check the value of ddlExport to determine which routine to use.


hth
matt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mlmccCommented:
Is this from a machine with Crystal installed or for the client machines.

From a VB application you can limit the export options by not including the export dlls in the installation.  The viewer looks for the dlls to populate the dropdown.  Don't know if that works with c# and .Net.

mlmcc
0
adders99Author Commented:
ahhh...interesting idea. Its on the client machines, so I might check that one out.

cheers guys

Adam
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.