Reputation: 3876
I have created a MVC project to view my crystal report. What I want to do now is export my crystal report to some specific file formats (PDF, Word, CSV etc). Before exporting the file I want to open my file explorer and give a name to the file, select export type, select specific folder and export it.
How can I do this?
Upvotes: 0
Views: 722
Reputation: 1422
If you use a Crystal Report Viewer to display the report on-screen, there are controls within the viewer that would allow a user to export the report and choose the export format and the folder and filename where it is saved. Some of your users may need some training to make effective use of some of the export parameters though. For example, when exporting to Excel there are a number of additional export parameters that can be used.
The nice thing about this method of exporting reports is the export feature is already fully implemented and all you have to code for is the creation and display of the report.
Upvotes: 0
Reputation: 169
Not sure if this works the same while using ASP.NET.
private string SelectLocation(string fileName)
{
SaveFileDialog brwsr = new SaveFileDialog();
brwsr.FileName = fileName;
brwsr.Filter = "Pdf|*.pdf";
//Check to see if the user clicked the cancel button
if (brwsr.ShowDialog() == DialogResult.Cancel)
return "";
else
{
string newDirectoryPath = brwsr.FileName;
return newDirectoryPath;
}
}
This is a piece of code to find out which path they want to use to save the file.
Upvotes: 1