Forum guidelines
Mar Porteza
How to Export Crystal Reports in Excel in proper format.....
Posted By Mar Porteza on 09 Aug 2007

I am using Visual Studio 2005 and Crystal Reports XI. I tried to export my report to Excel in Crystal Reports XI, File - Export - Export Report and I can see my reports in Excel (Data Only) the way I want to see them. My problem is when I call my report from my Web Application using VS 2005 and SQL 2005 database, and export my report to excel using the report viewer, it looks different....Is there any way I can use the Excel set up in Crystal Reports...meaning same look what I saw when I tried to export in Crystal reports???...or is there any functions that I forgot to enable??..if this should be done in a code, can you show me or send me a code????..Please.. need your help! Thank you much!!!!

RAM - 323


Re: How to Export Crystal Reports in Excel in proper format.....
Posted By savio on 10 Jun 2009  

ExcelFormatOptions CrFormatTypeOptions = new ExcelFormatOptions();
CrDiskFileDestinationOptions.DiskFileName = "filename.xls";
CrExportOptions = cryRpt.ExportOptions;
CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
CrExportOptions.ExportFormatType = ExportFormatType.Excel;
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
CrExportOptions.FormatOptions = CrFormatTypeOptions;
hope it will help u.


Re: How to Export Crystal Reports in Excel in proper format.....
Posted By Deepak Bhatia on 18 Sep 2009  
The same kind of problem was noticed by me, i.e. while exporting the header field value were not shown in the excel file. Solution: Open your crystal report in Visual Studio and make sure all the columns which are being shown are having same height i.e. the boxes which are shown in header as well as the text boxes of details section should have same height. Reason why this happens In Crystal Reports .NET, the Excel export attempts to perform a WYSIWYG translation of the report. This can sometimes lead to some interesting results in Excel, since a Crystal Report places objects using x/y coordinates, but Excel uses line-by-line row/column placements.

Please do not forget to mark answer as accepted if it helped you.

Deepak Bhatia

C# Corner Annual Conference 2016


Spire.Doc - Free .NET Word API
Use Spire.Doc to create, read, write, print, and convert word documents to OpenXML, RTF, TXT, XPS, EPUB, EMF, HTML, Image and PDF.