Link to home
Start Free TrialLog in
Avatar of mustafvi
mustafvi

asked on

Export to .csv file (Urgent)

Hi all,
I want to export my Crystal Report to .csv file.
I am using .Net with C#(ASP.Net).
How i can do this in .Net Framework using ASP.Net (C#)??


ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mustafvi
mustafvi

ASKER

Dear mlmcc,

in the above link, it is not mentioned to export in .csv file.
so, please first do the thing and then mail me the exact answer.

Please, mustafvi, for 50 points - don't be too demanding.
I don't have .Net or C# so I took a shot that it had what you wanted.  

I believe the examples show how to export.

I thought the only thing you would have to do is
1.  Set the export type - TOFILE rather than TOAPPLICATION
2.  Set the diskfile name
3.  Set the fileexporttype to creftCSV (i think that is the type for a CSV file)

C# may require other things.

Sorry.
mlmcc
Dear,
How i can do the above mentioned things.
Did you look at the code supplied in the earlier link?  Is any of it useful?  If so post it.  I can give you what works in VB but the .NET & C# are much different.

mlmcc
Dear all,
How i can export .rpt to .csv file.

Following is the Source code to export it into PDF format on export button in C#(ASP.Net). Please reveiw it and reply me the code of export in .csv file


               CrystalReport1 myrpt = new CrystalReport1();
               CrystalDecisions.Shared.DiskFileDestinationOptions ds = new CrystalDecisions.Shared.DiskFileDestinationOptions();
               myrpt.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
               myrpt.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
               ds.DiskFileName="D:\\Test\\MyReport.pdf";
               myrpt.ExportOptions.DestinationOptions = ds;
               myrpt.Export();
Can you not search for 'ExportFormatType' in your help files and find the option for CSV?

I also do not have .NET
Try
myrpt.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.CSV;

myrpt.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.CommaSeparatedValues;

ds.DiskFileName="D:\\Test\\MyReport.csv";

mlmcc
Dear all,

When i try to use the above thing it shows me an error message as
CrystalDecisions.Shared.ExportFormatType ,
does not contain a definition for 'CSV',
so, please check it and then mail me.
Just went looking for some documentation.

The .NET documentation is in the MSDN documentation

http://msdn.microsoft.com/library/?url=/library/en-us/crystlmn/html/crconcrystalreports.asp?frame=true


According to this it doesn't seem to hace a CSV export capability.  Here are the formats it lists.

Member Name Description
Excel        Export format of the report is a Microsoft Excel file.
HTML32       Export format of the report is an HTML 3.2 file.
HTML40       Export format of the report is an HTML 4.0 file.
NoFormat     No export format specified.
PortableDocFormat     Export format of the report is a PDF file.
RichText     Export format of the report is a rich text file.
WordForWindows     Export format of the report is a Microsoft Word file.

sorry
mlmcc
Just verified using the feature comparison pdf from CR.
The export formats are on page 3 of the document and CSV is not supported by .NET

http://support.crystaldecisions.com/communityCS/TechnicalPapers/cr9feat_ver.pdf

mlmcc
Do you have a fancy layout that you are exporting from?

If your goal is just to export to CSV then we could probably do it another way.
Could export to Excel then go to CSV.
Could write an asp application to export the recordset.

mlmcc
This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in approximately one week.  I would appreciate any comments by the experts that would help me in making a recommendation.

It is assumed that any participant not responding to this request is no longer interested in its final deposition.

If the asker does not know how to close the question, the options are here:
https://www.experts-exchange.com/help.jsp#hs5

mnye
EE Cleanup Volunteer
My last 2 comments showed what he wants to do can't be done with his version of Crystal.

mlmcc
Wrong!

Your last two comments have little to do with it!  But maybe a couple before then.

Please give the points to mike - errm - mlmcc.
You're right.  must have been asleep when I looked at that one.

mlmcc
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: mlmcc {http:#7571146}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

mnye
EE Cleanup Volunteer