Solved

Limiting the Export types in a C# Crystal Reports Viewer

Posted on 2003-12-03
7
773 Views
Last Modified: 2008-02-07
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
0
Comment
Question by:adders99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 7

Expert Comment

by:mnye
ID: 9867557
static drop down box with the two option, depending on selected value set your exportoption value accordingly.

hth
matt
0
 

Author Comment

by:adders99
ID: 9867603
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
 
LVL 7

Expert Comment

by:mnye
ID: 9867635
can you post some code, im not too sure what you are using.
thanks
matt
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:adders99
ID: 9867676
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
 
LVL 7

Accepted Solution

by:
mnye earned 50 total points
ID: 9867729
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 9868734
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
 

Author Comment

by:adders99
ID: 9873040
ahhh...interesting idea. Its on the client machines, so I might check that one out.

cheers guys

Adam
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question