Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports
 
Published: 22 Jun 2004
Unedited - Community Contributed
Abstract
When exporting from Crystal Reports .NET to Excel, the output can turn out to be unusable without a lot of reformatting in the spreadsheet. This tends to make business managers unhappy. Fortunatly, with a few programming and report formatting options, you can have perfect Excel exports with very little effort.
by Richard Dudley
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 413881/ 647

Introduction, and How Crystal Handles Excel Output


Introduction

I recently received some feedback regarding a close-to-launch project.  The testers reported that they could not manipulate the Excel spreadsheet that was generated from Crystal Reports.  In particular, they received the error "This operation requires the merged cells to be the same size." when they tried to sort the data.  This report looked great as a PDF, but when I tested the workbook, I saw their problem.  Although the report looked good at first glance, close inspection showed there were all sorts of weird sized columns and rows stuck in here and there.  Therein lies the problem, and fortunately, a solution is not too difficult even in Crystal Reports .NET.  The entire demo will take about 30 minutes.

This article assumes you have a basic working knowledge of the Visual Studio .NET IDE, adding controls to pages, and creating Crystal Reports.  You will also need to have the eXtreme Traders database in some form available to you.  The Access version is installed with your Crystal Reports .NET installation, and we'll use this database in our example.  I use Visual Studio .NET 2003, and although I don't anticipate any differences between VS 2002 and VS 2003, please contact me if there are any.

How Crystal Reports Handles Excel Export

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.  I am not sure why Crystal engineers thought WYSIWYG in Excel was a good idea, since we have our choice of PDF, RTF or HTML outputs.  Intuitively (to me anyway), people want data in Excel so they can manipulate it further, not because the report maintains its pretty formatting.  This may have been done in order to entice us to upgrade to a full version of CR, or it may be an example of giving too many features where fewer is better.

Crystal Reports 9 has an "Extended Excel" option, and CR 10 replaces this option with one called "Data Only".  In either case, the objects are rendered as closely as possible to row/column format, making the exported spreadsheet more usable without having to resort to some of the tactics we'll use below.  Since neither of these options is available to us in CR .NET, we will have to compensate with some formatting and design changes.

Business Objects has released a whitepaper regarding Excel exports in CR 10.  This whitepaper can be downloaded from http://support.businessobjects.com/communityCS/TechnicalPapers/cr10_export_excel.pdf.asp, and provides some useful information.  Keep in mind that the whitepaper discusses features found in CR 10 that are not found in CR .NET.  The troubleshooting section in particular is useful and general enough to apply to CR .NET as well as CR 10.  We'll use some of the information from the whitepaper as well as some of my own experience in a simple example.

Setting Up the Demo Project

The instructions in this section are necessarily brief where covered in other articles on this website.  For this demo, we will use the xTreme database that is included with the Crystal Reports .NET installation.

In Visual Studio, create a new ASP.Net web application.  In my case, I've named the project "Excel", but you can name yours whatever you like.  Next, add a new Crystal Report to your project.  We'll name this one "bad.rpt" to signify the bad layout.  Use the Standard Report Expert to create your report, and follow these steps:

  1. On the "Data" tab, drill down OLE DB (ADO) >> Make New Connection.
  2. Choose "Microsoft Jet 4.0 OLD DB Provider", and click "Next".
  3. VS 2002 users should browse to "C:\Program Files\Microsoft Visual Studio .NET\Crystal Reports\Samples\Database", and VS 2003 users should browse to "C:\Program Files\Microsoft Visual Studio .NET\Crystal Reports\Samples\Database".
  4. Select "xtreme.mdb" and click "Finish".
  5. Choose the "Employee Address" table, and click "Next".
  6. Add the following fields to the report: ID, City, Region, Country, Postal Code.
  7. We'll skip the rest of the options available to us for this sample, so click "Finish".

Your report will appear in a default layout.  Save the report file.

Open WebForm1.aspx.vb, and add the following imports to the very top of the file:

Imports CrystalDecisions.CrystalReports.Engine 
Imports CrystalDecisions.Shared

Add the following code to the Page_Init event after the "InitializeComponent()":

 Dim rptExcel As New ReportDocument
Dim strExportFile As String = Server.MapPath(".") & "/bad.xls" 
rptExcel.Load(Server.MapPath("bad.rpt")) 
rptExcel.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile 
rptExcel.ExportOptions.ExportFormatType = ExportFormatType.Excel 
Dim objOptions As DiskFileDestinationOptions = New DiskFileDestinationOptions 
objOptions.DiskFileName = strExportFile 
rptExcel.ExportOptions.DestinationOptions = objOptions
rptExcel.Export() 
objOptions = Nothing 
rptExcel = Nothing
Response.Redirect("bad.xls")

Grant "Modify" permissions on your project's directory under IISRoot to the ASPNET user (this is required to you can export an Excel file to the hard disk).  Save all the files, compile and run your project.  If all went well, you should be prompted to open an Excel spreadsheet.  Go ahead and open the Excel spreadsheet.

Analyzing the Bad Output, and Turning Bad Into Good


Analyzing the "Bad" Output

Place your cursor in the Employee ID column.  Notice that it is one cell wide.  Now move your cursor one column to the right, to the City column.  Notice this is four fields wide.  Look at the rest of the fields the same way.  Region is four cells wide, Country is four cells wide, and Postal Code is three cells wide.

Now, highlight all of the data (not the headings--just the data).  Navigate Data > Sort, and choose Column A as your sort column, and click OK.  You should receive an error message that says "This operation requires the merged cells to be identically sized."  This message is the fast track to angry sales managers paying you a visit.  They do not want to slice and dice a spreadsheet so that the columns fit properly.  They just want it to work when the data are exported.

Turning "Bad" into "Good"

There are several report formatting options and document properties you can set programmatically for Excel output.  One of the programming options is "ExcelUseConstantColumnWidth".  When set to true, the Crystal engine will set all Excel fields to the same width, and merge as many fields as necessary to hold the entire field.  Setting this to false will let the Crystal engine put each value in a single cell of a more appropriate width.

Add the following lines of code:

 Dim objExcelOptions As ExcelFormatOptions = New ExcelFormatOptions
objExcelOptions.ExcelUseConstantColumnWidth = False
rptExcel.ExportOptions.FormatOptions = objExcelOptions 

so that your Page_Init now reads

 Dim rptExcel As New ReportDocument
Dim strExportFile As String = Server.MapPath(".") & "/bad.xls"
rptExcel.Load(Server.MapPath("bad.rpt")) 
rptExcel.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile 
rptExcel.ExportOptions.ExportFormatType = ExportFormatType.Excel
Dim objExcelOptions As ExcelFormatOptions = New ExcelFormatOptions
objExcelOptions.ExcelUseConstantColumnWidth = False
rptExcel.ExportOptions.FormatOptions = objExcelOptions
Dim objOptions As DiskFileDestinationOptions = New DiskFileDestinationOptions 
objOptions.DiskFileName = strExportFile 
rptExcel.ExportOptions.DestinationOptions = objOptions 
rptExcel.Export() 
objOptions = Nothing 
rptExcel = Nothing
Response.Redirect("bad.xls") 

Now, rebuild and run your project.  You'll see now that there are very narrow columns between each of the data columns.  Tabbing from column to column shows that Employee ID uses a single cell, City requires two cells (a narrow one, probably C, and a wide one, probably D), Region and Country each use a wide cell, and Postal Code uses two cells.

What's going on here?  The answer is that the "variable column width" option is not perfect.  Better than before, but not perfect.  When a column is comprised of merged cells, this is usually because the Crystal engine could not figure out how to size the column properly.  There may have been a spacing issue, or the width of the data column was such that the engine couldn't figure out how to best size the column.  Fortunately, with a little design tweaking, we can cure the rest of our problems.

Design factors that influence Excel output include:

  • field width
  • field height
  • spacing between fields
  • alignment of fields in the same column

Looking at the data in Postal Code, we can see the column is wider than necessary--it really only needs one cell.  Perhaps by making it the same width as Employee ID field in our report, it will be the same width in Excel.  To do this, select the header and field for Postal code, then the header and field for Employee ID.  Make sure to select Employee ID last.  Right-click on any of the selected fields, and choose Size > Same Width.  Save your report, rebuild and run your application.  Make sure to close your browser--don't just reload the page.  Sure enough, Postal Code is only one cell wide.  However, the column titles are truncated.  This will take some trial and error on your part by stretching the columns to get right, but now you know the process.  Make sure to keep the header the same width as the field in the report file.

What about City?  Trying the same resizing trick reveals that it's already the same size as Region and Country, yet the latter two only require one cell.  As I mentioned above, another cause of merged cells is odd spacing between columns.  Zoom in to about 150%, and you'll see that all of the data columns are approximately the same distance apart--about 1 grid spacing.  Adjusting the spacing and rebuilding/running shows that we didn't fix a thing.  The answer is actually a little higher on the page--the Print Date field.  Set the Print Date field to the same width as Employee ID, save/rebuild/open, and everything should be nicely arranged, all in columns that are one cell wide.  If you need more room for a report title, stretch the title field so that its width is equal to that of several columns.  When the report is rendered, the stretched field will be merged cells, but the data columns will remain separate.

Besides sizing all the fields in the same column to the same width, these fields should be aligned neatly.  In our simple example, we probably don't have any alignment problems.  But, if you need to align a number of fields, select all the fields you want to align.  Right-click on the field you want to match the others to, and choose Align > Lefts from the menu.  You can align lefts, rights, tops, bottoms.  Try a few options and see what happens (you're not going to break anything, and this is a learning exercise).

If you see very thin rows or columns between other rows or columns, adjust the spacing between the elements.  Try and maintain a consistent spacing horizontally as well as vertically--this helps the Crystal Engine determine where to place the cell boundaries.  Ideally, there should only be one grid space between two elements.

In our little demonstration, cleaning up the few formatting problems (such as truncated column headings) will require a little patience and possibly a few cycles of resize/save/rebuild/run.  You can resize the column headings, making sure the data field is the same width.  When designing production reports, the process actually goes fairly quickly if you know what to look for.

Conclusion

  • Getting the output perfect may be an iterative process, requiring several rounds of making changes and reloading the report.
  • Make sure everything that should appear in one column is aligned neatly, and is the same width.
  • Put as few heading fields as necessary.  Excel output usually doesn't require a page number, print date, report title, etc.  If you don't need them, remove them from the report.  If you do need these fields, you'll need some patience to get everything to size correctly.
  • Try and have uniform sizes for all your fields.  Make the fields as wide as they need to be, but try and keep as few different sizes on your report as possible.  Excel columns can be resized easily with a mouse click, so it's not a big deal to have a lot of large fields (if they'll all fit on your page--see below).
  • Space the data fields as closely as possible--preferably with only one grid spacing between each data field.  Try and maintain uniform spacing, preferably a single grid space, between all elements.
  • You may need to adjust the width of your page to accommodate all the fields.  Since people will be adjusting the column width, and possibly adding summary cells, the actual page width doesn't matter too much.  Try setting the report page to landscape, and use larger paper sizes if necessary.  Visit my blog for a short example of how to "Change Paper Size and Orientation in Crystal Reports .NET".
  • In your application, you may need to build two reports to serve two purposes.  One report formatted nicely with headers and page numbers to be printed, and one report that is intended to export to Excel.


User Comments

Title: XVBVCB   
Name: VBXCVB
Date: 7/17/2012 7:48:40 PM
Comment:
ZBZBVXCVB
Title: Export crystal report data to Excel data in SSL implementation Site   
Name: Purna Chandra
Date: 2/27/2012 4:02:05 AM
Comment:
Unable to download Excel Data.
Recently we implemented SSl to our Site.
from that day onwards we are unable to download Excel data from Crystal Report Export Viewer.

Please someone help me...

Thank's,
Purnachandra
Title: Colour problem when exporting   
Name: PhilipRNel
Date: 1/12/2012 9:14:37 AM
Comment:
Good Day
I would like to find out if any one will be able to give me some advice on my following problem.

I used custom colors in my crystal report and when i export the report to Excel all is well, but as soon as i export my report through my program i wrote visual studio 10 it turns my custom colors to white and red. If any one has any idea why this is happening could you please help.
Title: It works   
Name: melvin
Date: 9/26/2011 5:08:55 PM
Comment:
\
\
Title: How to do the same in java   
Name: Samir
Date: 9/9/2011 8:02:42 AM
Comment:
How the same issue can be fixed if Crystal Reports is used in a Java/J2EE project?. I am setting the different options in JSP using CrystalReportViewer object
Title: Problem in exporting headers   
Name: Ayman
Date: 6/28/2011 4:46:00 AM
Comment:
After I export crystal report "130 pages" to excel. Only header of the first page appeared and all other pages without headers.
Title: crystal report to ms excel   
Name: wan
Date: 4/25/2011 10:06:12 PM
Comment:
i want to export crystal report to ms excel but the export icon not function in window 7
Title: repoting service   
Name: saro
Date: 8/3/2010 4:10:00 AM
Comment:
i need to no hw to set the alignment for print option in reporting service...
Title: export crystal report   
Name: mitali
Date: 6/30/2010 12:23:13 AM
Comment:
thank u so so so much........i get my report by click on export button.....thank u so much
Title: Crystal report export to excel   
Name: chagig
Date: 5/27/2010 11:44:05 AM
Comment:
I need to know why when a had a colum in my report and a export to excel , that new colum are always place at the end in Excel. It does'nt respect the order of the colum of the report????
Title: exporting in excelsius   
Name: Panga Ramesh Kumar Reddy
Date: 4/14/2010 5:38:01 AM
Comment:
Hi would you please suggest me how to get the drill down data that's exported form the crstal reports.I wish to get the drill down data tha'ts in the crystal reports....
Title: crystal report export to excel issue   
Name: raymond
Date: 4/1/2010 2:04:30 AM
Comment:
why crystal report export to excel data only, the title will be put on the wong place.
Title: Help   
Name: dale
Date: 2/3/2010 3:18:57 PM
Comment:
I want to create a stand alone vb.net application that will convert a saved .pdf file to an .xls file, prompting the user to specify the file. Any suggestions? We are using a crystal web service to create the file and display in crystal viewer. The user can save the file in .pdf format but want to be able to sort the data in excel.
Title: Fuck you   
Name: To much Talk
Date: 1/16/2010 7:24:52 AM
Comment:
Aahahaa... fucking Saling work... in here...
Title: Crystal Reports 2008 Introduction   
Name: vishnu vardhan, Hyderabad.
Date: 1/4/2010 2:56:38 AM
Comment:
Crystal Reports 2008 Introduction


Overview
Organizations use reporting tools to access data sources and generate customized reports. Crystal Reports® 2008 enhances report building and report processing techniques with a slew of features that add value to your presentation. In this course, you will create a basic report by connecting to a database and modifying its presentation.

Course Objective
You will connect to a database to extract data and present it as a report.

Target Student
This course is designed for persons who need output from a database. In some cases, database programs have limited reporting tools, and/or such tools may not be accessible. Students may or may not have programming and/or SQL experience.

Prerequisites
Before taking this course, students should be familiar with the basic functions of Windows, such as creating and navigating folders, opening programs, manipulating windows, copying and pasting objects, formatting text, and saving files. In addition, students should have taken the Microsoft® Office Access 2007 Intro course or have equivalent experience with basic database concepts.

Delivery Method
Instructor led, group-paced, classroom-delivery learning model with structured hands-on activities.

Performance-Based Objectives
Upon successful completion of this course, students will be able to:
explore the Crystal Reports interface.
create a basic report and modify it.
use formulas for filtering data.
build a parameterized report.
group report data.
enhance a report.
create a report using data sourced from an Excel database.
distribute data.
Title: Exporting Crosstab reports to .xls or .csv   
Name: Lara
Date: 8/27/2009 9:56:17 AM
Comment:
Hi :)

Thank you for a very informative article, realy helped!

My problem is that I have a report containing two crosstab grids, these I have to place right next to each other so that they seem like one long crosstab. Firstly, I am suppose to export them to .csv, but with my version of visual studio I do not have that option, so now what I am trying to do is convert the report to excel and then convert it to csv. Problem is, even though the crosstabs display next to each other on the grid viewer, once exported to excel they get placed underneath one another.... Any suggestions?
Title: My suggestion   
Name: Nilesh
Date: 7/23/2009 1:10:19 PM
Comment:
Changing the ExportFormatType to ExportFormatType.ExcelRecord will solve the problem of getting odd rows problem.
Title: Protect Excel Sheet   
Name: Dennise
Date: 7/15/2009 1:51:09 AM
Comment:
Hi, is there a way to control through crystal report so that the report exported to excel is being protected?
Title: Scanned images in CR conversion to Excel   
Name: Mrinal Mohan
Date: 7/10/2009 10:10:23 PM
Comment:
We are having diffculty in exporting images in CR to Excel. the other text data is perfectly fine. the problem is with the scanned images like the e-mail field, mobile number and address fields

please suggest a solution

mohan@ddaindia.com
Title: Crystal Export to Excel returns dummy record   
Name: pm
Date: 6/26/2009 6:51:09 AM
Comment:
Hi

I have seen a weird issue with CR 10. The report is based on a stored Procedure and in one of the case it retruns 0 rows (as expected). When viewed in the Designer interface it shows correctly "Records: 0" fetcehed. But when you select Export->CSV and enter delmeter as other then comma say "|" and open in Excel env. it shows a dummy record with pipes though there are no records. The problem is I have an auto program which run the report for multiple i/p values and combines them into one o/p set and I cannot add conditions to check if zero records were returned. Why is Export returning dummy record when 0 were fetched
Title: crystal report   
Name: kapil dhariwal 9953012260
Date: 6/20/2009 5:26:58 AM
Comment:
Really Nice Solution
Title: Restriction on number of records per worksheet   
Name: Crystal
Date: 1/21/2009 1:49:31 AM
Comment:
I am using Crystal report XI.
I tried to export to excel with records more than 65536. It is automatically exported into different worksheets depending on the records.
Can we restrict the number of records per worksheet?

Thanks in advance.
Title: mr   
Name: Taiif(benzino@bornleader.co.in)
Date: 1/8/2009 4:29:14 AM
Comment:
How can i disable export to crystal report option in the export button in crystal report viewer? thnx
Title: Export crystal report data to Excel data   
Name: Shail Nautiyal (shail_nautiyal@yahoo.co.in)
Date: 12/1/2008 2:07:47 AM
Comment:
//Muhammad Aftab ,

//put this code under your "export to excel" button....

abc.ReportDocument.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.Excel, Response, true, "exl");
abc.ReportDocument.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.ExcelRecord, Response, true, "exl1");

// where abc is :

CrystalDecisions.Web.CrystalReportSource abc = new CrystalDecisions.Web.CrystalReportSource();
Title: Export crystal report data to Excel data   
Name: shail nautiyal
Date: 12/1/2008 2:01:32 AM
Comment:
abc.ReportDocument.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.Excel, Response, true, "exl");
abc.ReportDocument.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.ExcelRecord, Response, true, "exl1");

// where abc is :

CrystalDecisions.Web.CrystalReportSource abc = new CrystalDecisions.Web.CrystalReportSource();
Title: Want to Export crystal report data to Excel data only   
Name: Muhammad Aftab
Date: 11/26/2008 1:26:50 AM
Comment:
kindly solve this problem as any only can...
Thanks
Title: Problem in Exporting to Excel   
Name: jsingh
Date: 10/29/2008 7:09:24 AM
Comment:
Superb solution...
Title: Problems after downloading Excel   
Name: Anoop
Date: 10/20/2008 10:56:55 AM
Comment:
Hi,
I am facing a problem when i am downloading excel from BO XI.Whenever i download the report in the excel format the tables in the report are broked up in different sheets but what i want is if the table is not entirely fitting in that sheet it should be downloaded in different sheet.I have applied the Avoid page break option in the BO.But it's not working with the excel.

Thanks in advance.
vermanoop2311@gmail.com
Title: Greet   
Name: avik
Date: 9/23/2008 2:31:22 AM
Comment:
it really helps me in my project./
Title: Problem with exporting   
Name: Zahid Khan
Date: 9/8/2008 2:46:25 AM
Comment:
Dear:
I faces a problem in exporting the crystal report, the report is shown successfully but not exported successfully, I uses my asp.net web application in two systems, one at my office and one at my home, in one system it exports successfully but in one system it is not. Please guide me to resolve my problem.
thank in advance.
zahid_khan_k@yahoo.com
Title: Miss   
Name: Sanda
Date: 7/28/2008 9:51:19 AM
Comment:
Thanks for the helpfull article.. i just started working on crystal reports and at after many attempts i have managed to export my report to excel...

VS 2008
SQL SERVER 2005 express
Title: generation of Excel during runtime   
Name: Sam
Date: 6/20/2008 2:03:31 AM
Comment:
Hi All,

Can we generate excel outputs with the help of crystal reports during runtime by using Java. We are exploring the option of generating rhe excel from our J2ee application.Please help me
Title: Having a problem in the rptExcel.Export() part   
Name: Randy
Date: 6/18/2008 5:00:17 AM
Comment:
Hi All,

I'm having a problem in the rptExcel.Export() part...
Please someone help me...
Title: Load report failed   
Name: Randy
Date: 6/15/2008 6:02:34 AM
Comment:
help me please....I'm developing a window application and having a problem in exporting crystal to excel
Title: Load report failed   
Name: Randy
Date: 6/15/2008 6:01:05 AM
Comment:
I'm developing a window application and I'm having a problem in exporting crystal to excel file because the 'Load report failed' error prompts me. Please someone help me...plsss....
Title: Column width problem in sub reports   
Name: MadhanKumar
Date: 4/29/2008 8:49:07 AM
Comment:
Hi..Thanks for ur excellent article.
I have a problem in export to excel from vs.Net2003 and crsytal reports.
I have the problem of cell alignment(merged,Left Indent) in sub reports(Multi column).No problem in main report.The column Header is in main report and data is in subreport multicolumn.
I also used Constantcolumnwidth to false and tried to fix the problem.
Can u tell me how to work with subreports on cell alignment in excel.
Thanks in advance.

It works fine for other reports which are having only Main report.But it has the
Title: Extract a report with 2 different Excel Sheets   
Name: Javier
Date: 4/25/2008 5:16:34 PM
Comment:
Hi everyone, i have this problem and i havent be able to solve it, I´ve searching in google but i havent found usefull information.
This is the problem: Im developing an aplication with VS 2005 and crystal reports, as the title of this comment says, i need to get two reports but not in different xls files but just one with different sheets, does anyone knows how to solve it, please let me know...
Title: Getting Error- {"Logon failed.\nDetails: crdb_adoplus : Object reference not set to an instance of an object.\rError in File C:\\DOCUME~1\\ENIVED~1\\   
Name: Niv
Date: 3/7/2008 7:11:52 AM
Comment:
got error
Title: To Carlos   
Name: Tanu
Date: 2/20/2008 7:15:15 AM
Comment:
Try
Dim i As Integer
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
'Dim CrTables As Tables
'Dim CrTable As Table
Dim pnames As ParameterFieldDefinitions
Dim pname As ParameterFieldDefinition

Dim param As New ParameterValues
Dim paramvalue As New ParameterDiscreteValue

creportdoc = New ReportDocument

Select Case Trim(UCase(reportname))
Case Trim(UCase("OrderDetail.rpt"))
Dim ordrpt1 As New OrderDetail
creportdoc = ordrpt1
Case Trim(UCase("OrderStatus.rpt"))
Dim ordrpt1 As New OrderStatus
creportdoc = ordrpt1
Case Trim(UCase("OrderStatusOTypeSummary.rpt"))
Dim ordrpt1 As New OrderStatusOTypeSummary
creportdoc = ordrpt1
Case Trim(UCase("OrderStatusGrandTotal.rpt"))
Dim ordrpt1 As New OrderStatusGrandTotal
creportdoc = ordrpt1
Case Trim(UCase("OrderShipment.rpt"))
Dim ordrpt1 As New OrderShipment
creportdoc = ordrpt1
Case Trim(UCase("OrderShipmentSummary.rpt"))
Dim ordrpt1 As New OrderShipmentSummary
creportdoc = ordrpt1
Case Trim(UCase("Receipt.rpt"))
Dim ordrpt1 As New Receipt
creportdoc = ordrpt1
Case Trim(UCase("shipmentproductmonthly.rpt"))
Dim ordrpt1 As New ShipmentProductMonthly
creportdoc = ordrpt1
Case Trim(UCase("shipmentmonthlyOType.rpt"))
Dim ordrpt1 As New ShipmentMonthlyOType
creportdoc = ordrpt1
Case Trim(UCase("shipmentOrderTypeTo
Title: To Hritik   
Name: Tanu
Date: 2/20/2008 7:12:41 AM
Comment:
you have to select the field & give borders then only it will be exported to excel with borders.
Title: Export not works   
Name: Carlos
Date: 2/7/2008 12:25:21 PM
Comment:
I forget to say:I'm working on a terminal session on Windows Server 2003
Title: Export not works   
Name: Carlos
Date: 2/7/2008 12:22:06 PM
Comment:
I generate a report from application, when I try to export (click on export bottom)nothing matters, somebody can help me
Title: HOW TO CREATE EXCEL FILE FROM CRYSTAL REPORT USING VB.NET 2003, I'M USING VB.NET 2003 FOR WINDOWS APPLICATION SIR   
Name: jessie.romero
Date: 2/1/2008 1:47:20 AM
Comment:
Sir can u help me to create an excel file from crystal report using vb.net 2003. can u give an example in visual basic windows application only sir? thanks and God bless
Title: Exporting from Crystal Report XI to Excel   
Name: Gisela
Date: 1/28/2008 5:18:46 AM
Comment:
I was able to export my crystal report (version 10.2) with the following code but when I tried using crystal report XI, I get the following error when it reaches this line:
rptExcel.Export()

System.TypeLoadException

'ISCREditableRTFExportFormatOptions_reserved5' of type 'CrystalDecisions.ReportAppServer.ReportDefModel.EditableRTFExportFormatOptionsClass' dell'assembly 'CrystalDecisions.ReportAppServer.ReportDefModel, Version=11.0.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' sta eseguendo l'overriding di un metodo che è già stato sottoposto a overriding.

It says that it's overwriting a method that is already overwritten?!??

Dim rptExcel As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rptExcel.Load(Server.MapPath("Report_Prova.rpt"))
'ReportUtility.EsportaReport(rptExcel, Response, Server.MapPath("."), Session.SessionID.ToString(), ReportUtility.FormatoEsportazione.Excel)

Dim fname As String = Session.SessionID.ToString() & ".xls"
Dim strExportFile As String = Server.MapPath(".") & "/" & fname
rptExcel.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
rptExcel.ExportOptions.ExportFormatType = ExportFormatType.Excel
Dim objOptions As DiskFileDestinationOptions = New DiskFileDestinationOptions
objOptions.DiskFileName = strExportFile
rptExcel.ExportOptions.DestinationOptions = objOptions
rptExcel.Export()
objOptions = Nothing
rptExcel = Nothing

Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/vnd.ms-excel"
Response.WriteFile(fname)
Response.Flush()
Response.Close()
'delete the exported file from disk
System.IO.File.Delete(fname)

I have excluded Crystal Report 10.2 references and added Crystal Report XI references to the project.

Can anyone please help?
Title: Exporting to Excel with Chart   
Name: RB
Date: 1/15/2008 7:15:12 AM
Comment:
Hi Jay,
Is your chart compatible or doable in excel? It's possible that it's a compatibility issue.
Thanks ;)
Title: Exporting to Excel with Chart   
Name: Jaimie Sandiko
Date: 1/9/2008 7:17:39 AM
Comment:
My problem is when I export the charts in excel, the grids in the chart doesn't show anymore. Is there a possible workaround for this? It works fine if we use export to PDF but doesn't work in export to excel. Thanks :)
Title: Page Break Problem   
Name: RJ Dudley
Date: 12/4/2007 8:36:58 AM
Comment:
Jaimie,

This isn't really a technical issue, it's more a design issue. You may need to mess with the design of your report to get them close. Even still, your end users may want to use the Print Preview feature in Excel to make sure everything is as they want it.
Title: Page Break problem   
Name: Jaimie Sandiko
Date: 12/3/2007 11:52:14 PM
Comment:
Hi, do you have any solution for page break problem. When I export the page break on excel, it is not the same as the output of crystal report. I find that I need 2 pages in excel to fit a 1 page report in crystal report
Title: Export rpt to pdf   
Name: Bishwajit Sahoo
Date: 10/15/2007 7:42:12 AM
Comment:
Hi Richards,
Please replay me- How can I export rpt file to pdf format.
Title: Not working   
Name: Bishwajit Sahoo
Date: 10/15/2007 7:40:07 AM
Comment:
It may be a good article,But in
rptExcel.Export() line, which parameter I have to pass,
Because withoput passing parameter it gives runatime error.
"Missing parameter values".
How could I solve that problem
Title: Exporting Vowes in Crystal exports   
Name: Pavan
Date: 9/19/2007 10:25:29 PM
Comment:
In my the report the data is being maintained in three detail sections. When i try to export data into Excel using data only excel option , the records ahould be displayed in only one row. But it is getting displayed in two rows. I am using crystal X1 and VB.net.

Earlier when i had used only Plain VB, i got the entire report in a single row. But here with VB.net i am facing the problem.

Please hekp me out in finding the problem.
Title: Blank values not setting data type in Excel   
Name: PSS
Date: 9/19/2007 4:42:33 PM
Comment:
Is there a setting in crystal which will apply the data format specified to an excel cell, even if the data value is blank?
Title: use in excel formate repots in vb.net   
Name: koshal kishor ,L&T LTD
Date: 8/16/2007 8:25:40 AM
Comment:
PLZ HELP ME
Title: Missing Parameter Value   
Name: Hari
Date: 8/16/2007 6:11:30 AM
Comment:
Hi,

I am Getting an error"Missing Parameter Values" . will u pls help to slove the error. Its very urgent .
Title: export into excel from oracle database   
Name: LRG
Date: 8/10/2007 1:12:07 AM
Comment:
Excellent article. I am developing an application where i need to export data and chart to excel. I'm new to crystal reports and this article really helped me in underdstanding it. Now my problem is that i have to export data from oracle 10g database. But getting error as logon failed. how can i rectify that error and get desired result?
Title: Same currency not exported to excel from crystal   
Name: ASL
Date: 8/9/2007 2:34:31 AM
Comment:
Hi,

The crystal report output has euro symbol, but when export to excel, it is exported as $ symbol. How can we force the same currency symbol to be exported to excel.

Thanks
Title: export   
Name: sridhar
Date: 8/8/2007 11:57:46 PM
Comment:
am getting an error like 'missing parameter current value'
Title: Thanks   
Name: Ramya
Date: 8/2/2007 11:54:08 AM
Comment:
One line of code saved me all the trouble...Excellent article.Thanks!!!
Title: Column Alignment in Crystal XI   
Name: Jeff
Date: 7/25/2007 12:34:44 PM
Comment:
Hi. WE have about 200 reports written in 8.5. We are now using VS2005, and have full Crystal XI. Reports that where exporting to Excel OK in 8.5, now export with over 100 columns, hence the client is not happy.
Is there a quick fix for this? I really dont want to align columns in all 200 reports.
We are previewing using the CrystalViewer, and exporting using the Toolbar implementation of Export.
Thanks.
Title: question   
Name: jm
Date: 7/10/2007 1:44:52 PM
Comment:
exists form to protect the file created? i can create pdf file, but try protect vs copy and select the file content
Title: g   
Name: g
Date: 6/26/2007 2:00:45 PM
Comment:
Dim rptExcel As New ReportDocument
Dim strExportFile As String = Server.MapPath(".") & "/bad.xls"
rptExcel.Load(Server.MapPath("bad.rpt"))
rptExcel.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
rptExcel.ExportOptions.ExportFormatType = ExportFormatType.Excel
Dim objOptions As DiskFileDestinationOptions = New DiskFileDestinationOptions
objOptions.DiskFileName = strExportFile
rptExcel.ExportOptions.DestinationOptions = objOptions
rptExcel.Export()
objOptions = Nothing
rptExcel = Nothing
Response.Redirect("bad.xls")
Title: export to excel   
Name: invincible
Date: 3/15/2007 7:32:02 AM
Comment:
How can we export a report to excel in CR XI Release 1?
I get an error like "exporterName is empty"

Here's the code snippet im using:

ReportExportControl exportControl = new ReportExportControl();
exportControl.setReportSource(reportClientDoc.getReportSource());
ExportOptions exportOptions = new ExportOptions();
exportControl.setExportOptions(exportOptions);
exportControl.setExportAsAttachment(true);
exportControl.setOwnForm(true);
exportControl.setOwnPage(true);
String exportFormat = (String) request.getSession().getAttribute("selectedFormat");
if(exportFormat.equals("0")){
exportOptions.setExportFormatType(ReportExportFormat.crystalReports);
}
else if(exportFormat.equals("1")){
exportOptions.setExportFormatType(ReportExportFormat.MSWord);
}
else if(exportFormat.equals("2")){
exportOptions.setExportFormatType(ReportExportFormat.MSExcel);
}

else if(exportFormat.equals("3")){
exportOptions.setExportFormatType(ReportExportFormat.RTF);
}

else if(exportFormat.equals("5")){
exportOptions.setExportFormatType(ReportExportFormat.PDF);
}

else if(exportFormat.equals("6")){
exportOptions.setExportFormatType(ReportExportFormat.recordToMSExcel);
}

else if(exportFormat.equals("7")){
exportOptions.setExportFormatType(ReportExportFormat.text)
}
else if(exportFormat.equals("8")){
exportOptions.setExportFormatType(ReportExportFormat.characterSeparatedValues);


Is there some issue witn this code??
}
Title: I have not found a way to export formula field value from crystal report 8.5 to export excel using ASP.NET with C#   
Name: P
Date: 3/15/2007 5:38:17 AM
Comment:
This article is good but i get error as thread was being aborted while running this code
Title: Displaying Gridlines   
Name: keval kakadiya
Date: 2/27/2007 2:13:41 AM
Comment:
I have not found a way to make the gridlines display in the exported Excel worksheet.so plz give me solution
Title: prusty   
Name: saroj
Date: 1/30/2007 6:00:39 AM
Comment:
Great article. Helped us fixed an incredibly frustrating problem with Crystal.
Title: Good Stuff   
Name: Robin
Date: 1/2/2007 3:21:52 PM
Comment:
This is a great act. Thanks man !
Title: exporting crystalreport & its data into Excel sheet   
Name: Muralidhar
Date: 12/12/2006 2:53:26 AM
Comment:
I want to export the crystal report and data into an Excel sheet
Title: Excel File too large   
Name: Pankaj Sutradhar
Date: 12/9/2006 6:59:24 AM
Comment:
Hi, When i say export to excel from my application the excel file i get is approx. 1.5MB in size. But when i use export to excel from CR environment then the file size is just 33KB. Even when i resave exported file(1.5MB) from my application thenits size reduced to actual size.

Why is the file size is too large when i export to excel from application?

can nay one help me ?
Title: SaiRam   
Name: Richard Dudlet
Date: 11/29/2006 8:38:15 PM
Comment:
No. Saving is done on the server (where the code runs), not on the client. You need to use additional code to send the file to the client.
Title: Truncated data   
Name: Richard Dudley
Date: 11/29/2006 8:37:07 PM
Comment:
You need to make the fields larger in Crystal. CR truncates the data based on the field size.
Title: Saving to the directory user selects   
Name: SaiRam
Date: 11/24/2006 1:06:22 PM
Comment:
The code was very helpful thanks.
I want to know if while saving the excel can a dialog box be give so that the user saves in his selected directory
Title: Display boolean field into Tick sign on Crystal Report   
Name: Eksanthan
Date: 11/23/2006 11:11:04 PM
Comment:
How to diplay boolean value into Tick sign (Check box) on crystal report.
I use Crystal report in Studio 2005
eareksanthan@yahoo.com
Title: export to excel (truncated field values)   
Name: Em
Date: 10/28/2006 7:24:47 AM
Comment:
hi!

I used the suggested codes to export a report to an excel file successfully. However, my data were truncated. When viewing the report, its ok if the data is truncated, but, when it's exported to an excel file the data should be complete.

I've created my reports in cr10 and loads the report in vb.net 2002.

What else do I have to do to fix this problem?
Title: generating dynamic crystal report   
Name: Richard Dudley
Date: 10/26/2006 9:28:55 PM
Comment:
mohan,

You need the full version of Crystal Reports, the version bundled with VS.NET does not have this capability. There are examples in the documentation, and from Business Objects' website.
Title: Format after Export   
Name: Richard Dudley
Date: 10/26/2006 9:26:16 PM
Comment:
In Excel, you should be able to highlight the fields or column which you need to reformat, then right-click and choose Format. Then, select the time format you want. I don't think there's a way to do this in Crystal.
Title: What about numbers to text   
Name: Scott Townsend
Date: 10/26/2006 9:48:29 AM
Comment:
Hey

Thank you for the excellent info, it answers about 6 of my questions about formatting.

I also noticed that you can select all in the excel document crystal creates and unmerge and you can then sort and manipulate.

The problem i am still coming up with is this: i am viewing report that have times on it. 00:02:34 or 2 min 34 sec.

It seems when crystal exports them (using data only or just the excel option) it exports it as a general format or effectively text, making it impossible to sum these numbers without manually inputting them into a calculator.

is there any way to change to number format after the export or maybe crystal script to export as a number value rather than text value.

Scott T
Title: generating dynamic crystal report   
Name: mohan
Date: 10/25/2006 10:18:37 AM
Comment:
Hello,
i hve to generate a reports at runtime..means, i hve to select specified columns and generate the dynamic sql and then generate a report at specified columns ..please help on this..

regards
mohan
Title: CSV   
Name: Richard Dudley
Date: 10/16/2006 9:34:20 PM
Comment:
CSV is not an option in the bundled version. You need the full version for that.
Title: Login Failed   
Name: Richard Dudley
Date: 10/12/2006 9:41:48 AM
Comment:
There are other articles about the Login Failed error at http://aspalliance.com/crystal/.
Title: Logon Failed Error   
Name: Farheen Husain
Date: 10/12/2006 1:36:16 AM
Comment:
after trying this code i m getting error
Logon failed for statement rptExcel.Export().
Please help
Title: How to export crystal report to csv format   
Name: Ramarao
Date: 10/5/2006 1:25:28 AM
Comment:
Pleae specify me How to export crystal report to csv format in .Net.I didn't see csv ExportFormatType.
Title: if excel is not instaled how to Export to excel from datagrid in vb.net   
Name: Krishna C.
Date: 9/21/2006 2:54:42 AM
Comment:
its very urgent,I want the code in vb.net if excel is not instaled then how to transfer data from datgrid into .xls file
Title: limitation to Export   
Name: arsalan
Date: 9/12/2006 5:27:25 PM
Comment:
I use export to excel in my asp.net pages. But the problem is that when the records returned are greater than 64K the rest of the recods are lost. This is because of a limitation in excel. Is there a work around for this ?
Title: XML from Crystal Reports   
Name: Richard Dudley
Date: 9/1/2006 8:42:40 AM
Comment:
You can't export to XML from the bundled CR. Why would you? Instead, you can create a dataset and export that to XML, or create a class and use the XML Serializer to save that as XML. There are many examples on the web, including this site, for using the XML Serializer (my preferred method).
Title: how to export data into xml format using crystal report   
Name: kishan
Date: 9/1/2006 4:07:21 AM
Comment:
i would like to know the code for exporting the data into xml format using crystal reports.
Title: excellent topic   
Name: mandyavenkatesh
Date: 8/28/2006 6:58:06 AM
Comment:
topic is exceellent,but i have one dought here,i am working on crystal reports with asp.net,i want to build crystal report,in which i need to runtime filteration of data,afetr populating the dataset ,the code is:

CrystalReport1 report=new CrystalReport1();
report.SetDataSource(ds);
// set report source
CrystalReportViewer1.ReportSource =report;

after adding crystal report i am not geting first line code in web applications,but same set of code works for me in windows application,will u suuggest me asap

thanks in advance
Title: Excel export options   
Name: Richard Dudley
Date: 7/31/2006 11:22:03 AM
Comment:
gayathri,

That Excel Export Options is not a feature of the bundled version. I think you need to use a full version of CR and the Report Application Server from Business Objects for that.
Title: Exporting to Excel   
Name: priyan
Date: 7/26/2006 5:46:06 AM
Comment:
I am not able to Exporting cross tab crystal report to Excel .
Title: The excel options window is not available in asp.net   
Name: gayathri
Date: 7/25/2006 6:27:12 AM
Comment:
Hi,

If I try to export the data to excel(data only) while designing the report in the Crystal report then I get the "Excel format options window", whereas this window is not available when I export the same data through the crystal report in the ASP.NET.

Can anybody say me how can get the "Excel format options window" when I try to export in the ASP.net crystal reports.
Title: Cover Letter   
Name: Richard Dudley
Date: 7/16/2006 9:37:43 PM
Comment:
I'm not 100% sure, since I haven't used CR 10 that much, but I don't think CR can create multiple worksheet exports.
Title: Navigation Problem   
Name: T R S Rao
Date: 7/9/2006 6:31:10 AM
Comment:
Hi its a good one.
Title: alternative for crystal report   
Name: vishal patil
Date: 6/28/2006 7:20:35 AM
Comment:
i am currently working on core banking project.In order to view repot i am using crystal reportviewer.While i print that report,printing happens to be very slow.For that i nedd alternative tool for viewing the report in asp.net
Title: Displaying Graph   
Name: Manish Joisar
Date: 6/23/2006 3:05:08 AM
Comment:
We have created Graph in Crystal Report
Exporting to Excel working fine but Graph is not coming
anything else we have to do for that

Regards
Title: Thanks   
Name: EnderAD
Date: 6/14/2006 12:47:44 PM
Comment:
Very useful and well-written article.
Thank you very much!
Title: export to excel   
Name: Arijit Saha
Date: 6/14/2006 1:24:55 AM
Comment:
thanx for da tut... realy helped me alot..
Title: Exporting in Visual Studio 2005   
Name: Stephen
Date: 6/7/2006 8:28:25 AM
Comment:
After following this tutorial and still struggling to export to excel correctly i found option

CrystalDecisions.Shared.ExportFormatType.ExcelRecord

This appears to be a new addition to VS 2005 and exports to Excel perfectly !!
Title: Exporting to excel charts in crystal report .net 2002   
Name: Mohd Rousan
Date: 6/1/2006 8:13:54 AM
Comment:
after exporting to excel i generate chart reflect the data on the excel but i generate the chart from Run Time XSD, what i need is to generate the chart from the excel since its a feature from excel itself.

i need to generate chart from an excel sheet when i change the data on the excel nothing happened it keeps the chart as is from the first.

appriciate any help
Title: Exporting crystal report into excel file   
Name: Harsh
Date: 5/15/2006 6:10:43 AM
Comment:
i have converted my crystal rpt in asp.net into excel but
data is not coming down req fields pls tell how to do it
Title: Excel report generation uing vb.net   
Name: santosh.gornal@gmail.com
Date: 5/8/2006 11:18:06 AM
Comment:
send me vb code for excel report generation
and asp code
Title: Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports   
Name: Madhi
Date: 4/28/2006 2:55:07 AM
Comment:
Extremely Useful this article is.
Title: How to Export crystatl Report to Excel Format   
Name: Suresh
Date: 4/15/2006 4:37:40 AM
Comment:
How to Export crystatl Report to Excel Format,
is it Possible?
How...
Can any one Help & Explain in detail
Title: I want to convert Crystal Reports in Excel Format   
Name: Ramesh
Date: 4/15/2006 3:29:24 AM
Comment:
I want to convert Crystal Reports in Excel Format
is if possibel?
if yes?
How....
Title: Excel & PDF   
Name: Purvi
Date: 4/14/2006 12:33:36 PM
Comment:
It is great article. It helped me resolve many formatting issues. However now I am facing another issue. I have one crystal report which I need to export to Excel as well as PDF. Using the above instructions I was able to align all my excel columns , but then PDF is not getting aligned. If I moved anyhting on the report to align on PDF, then my excel sheet is not aligned anymore.
Can somebody please suggest anything. It is very urgent.
Thanks in advance.
Title: Get a Crystal Report field(x,y) coordinates   
Name: Adriana
Date: 4/10/2006 2:56:20 PM
Comment:
Hi,

Can someone please let me know how to find out (x,y) coordinates from a Crystal Report, I need to obtain the row/column for each field for several reports that are already being created. thanks a lot
Title: Blank report hanhs aspnet_wp   
Name: Richard Dudley
Date: 3/29/2006 8:27:47 PM
Comment:
If you have no data, you should get a blank report. The worker process shouldn't hang up. You need to look at your export code.
Title: When Report viewer has ZERO Record and Export to Excel   
Name: Pankaj Sutradhar
Date: 3/28/2006 11:44:21 PM
Comment:
When i am exporting a crystal Reports Which has no Record in output, It hangs aspnet_WP.exe

Can anybody tell me how to find count of mycrystal output so thast i can not export it.
Title: want to store a value from crystal rpt to a database   
Name: bm
Date: 3/22/2006 4:56:11 AM
Comment:
Hi Friends
i have created a crystal report which contains some calculations. here i have used formula field for calculation purpose.
ex: i have named labor rate as @laborrate=serv + tax
i also got the answer for the same.There is no problem.
The problem is,i need to store these datas into a table.
i have about 6 formulas.Also ave created the table for the same which contains 6 fields
Now wat i want to do....or how to proceed....to store the displayed Values in the crystal report -->to a db table
tanx n regards
bm
Title: Working locally, not on server?   
Name: Lynn F
Date: 3/21/2006 12:24:33 PM
Comment:
I used the above code and it worked great while I was at my workstation using VS 2003 and debugging. I put the code on the server and the excel output goes back to constant width columns. Any idea what gives?

I have tried the following to remedy the problem;
1. Uninstall and reinstall my website on the server
2. Redo the report and copy to the server.
3. Manually delete out the files on the server and re-install.

I get the same results. Locally I get varible width columns that look great, from the server I get fixed width excel columns!!! Agh!

Any help?

Thank you....
Title: Thanks a lot for helping me to fix alignmemt issue   
Name: Irudayaraj Backiaraj
Date: 3/17/2006 12:06:16 PM
Comment:
Thank you very much for providing a simple and elegant solution for excel column alignment issue.

Regards,
Irudayaraj
Title: Good   
Name: Andy
Date: 3/15/2006 5:51:55 AM
Comment:
The alternative export to excel from a DataSet seems long winded epecially as i've taken the time to produce nice reports. Many thanks for your sugestions i shall follow the advice given. Adobe exports looks fine can this be saved in an excel format.

Thanks again
Title: d   
Name: sd
Date: 3/6/2006 3:54:27 AM
Comment:
Can u provide any material for this matter.
Title: Problem in exporting to .DOC   
Name: Richard Dudley
Date: 3/5/2006 2:17:08 PM
Comment:
kk,

With that many images, a Crystal Report may not be the best idea. You might need to use the VSTO to directly create a Word document.
Title: Problem in exporting to .DOC   
Name: kk
Date: 2/22/2006 12:04:49 PM
Comment:
HI Richard,
I read many of your great articles. I am crystal reports to generate a report with around 100 Images, where each Image size is 160 KB and retining entair color depth. Generating and diplaying it in crystal report viewer it is workign fine. But when exporting to word throwing "out of memory exception". Can you suggest me any third party tool or any trick to export this report to MS WORD with out getting error.
Thank you
KK
Title: printing/Watching in Landscape   
Name: Bhavesh Rajdeep
Date: 2/22/2006 6:15:56 AM
Comment:
Hi,
Your article is Great.

I worked on crystal report for "Displaying","Navigating","Exporting" and "Printing" the report.

I had completed all the task but only one thing is not getting solved, that is how to set the page in a Landscape format while watching page(page contains the crystal report) for print preview. It exports in Landscape format or we can say exports as the report is.

I used @media and @print but it cant work.

Can u provide any stuff for this matter.
Title: Export to Excel from CR 9   
Name: Arch
Date: 1/23/2006 6:38:48 AM
Comment:
I am exporting the crystal report to Excel & Word...
Can we export Boxes & Lines to Excel & Word both and get the same output....

Please help me as i can get output in Word but not in Excel

Regards,
Arch
Title: Export Crystal reports into rpt file   
Name: Shan
Date: 1/18/2006 4:53:52 AM
Comment:
I have seen your code for exporting Crystal reports into Excel. Samething can we export Crystal reports into rpt file with data?
Title: Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports   
Name: Deepa Vincent
Date: 1/13/2006 6:11:45 AM
Comment:
Very good article .
Thanks
Title: Crystal report not getting exported in excel   
Name: Aanchal
Date: 1/9/2006 2:00:05 AM
Comment:
When i m exporting rpt file in excel i exit from the application(exe from where i m exporting file) and it gives an unknown error.
Moreover when i am trying to open that exported excel file it shows "unable to open file"

what is the reason of this error.can any body help me .
Title: Showing the Gridlines   
Name: Richard Dudley
Date: 12/30/2005 8:37:57 PM
Comment:
For some reason, CR paints the cells white when it exports to an XLS. See if this blogpost helps:
http://aspadvice.com/blogs/rjdudley/archive/2005/04/20/2583.aspx
Title: Exporting Title   
Name: Richard Dudley
Date: 12/30/2005 8:32:21 PM
Comment:
Aromasy,

Ask your question in the Crystal Reports forum at http://asp.net. Your problem may need a few messages back and forth, and this isn't an ideal forum for such.
Title: Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports   
Name: Aromsay
Date: 12/30/2005 2:15:46 PM
Comment:
Your article is very help full. But I have question. After export to excel how can I export title? It seems title for each column did change at all. My title's column was dynamic e.i : 20004 then I change to 2005 on crystal report it changed but when I exported to excel it won't change at all. How do I do that? Any idea?

Aromsay Chanthasoto
Title: Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports   
Name: Hrithik
Date: 12/24/2005 8:03:57 AM
Comment:
i'm able to view the entire data but without borders ..
can anyone help me its very urgent...
Title: Exporting to Excel in Crystal reports.Net   
Name: Hrithik
Date: 12/24/2005 7:58:41 AM
Comment:
Hi...
i'm using VB.Net to export crystal report to an excel format..but i wanna do it along with the boxes n lines which r present in the crystal report..
basically i want to display the excel in the same format as my crystal report..
i'll b really thankful if anyone can help me in this regard...
Title: Exporting to Excel in Crystal reports.Net   
Name: Hrithik
Date: 12/24/2005 7:56:02 AM
Comment:
Hi...
i'm using VB.Net
Title: Thanks a lot   
Name: Sarvesh sharma
Date: 12/19/2005 4:21:40 PM
Comment:
This article helps us a lot
Title: Consultant   
Name: Jamal Gilani
Date: 12/14/2005 5:40:30 PM
Comment:
This is a very good article, It gives some idea to over come the Column merging problem, but still there is a problem with Row merging.
Title: page orientation   
Name: Lynn F
Date: 12/12/2005 4:10:22 PM
Comment:
I have a Crystal Report that I export to Excel through ASP.NET. When I am in debug working locally on my machine, the export comes out correct with the spreadsheet oriented in landscape. When I use the same code on the server, the excel spreadsheet comes out in portrait.

Is there an ExcelExportOption that will force the excel spreadsheet to be default oriented in landscape?

Thank you.
Title: Connect Datagrid   
Name: Richard Dudley
Date: 11/3/2005 9:17:09 AM
Comment:
Meena,

You don't connect a datagrid to a Crystal Report. You can connect a dataset to a report, though. You will find code and examples at http://support.businessobjects.com/communityCS/TechnicalPapers/rtm_reportingoffadonetdatasets.pdf.

If you have additional questions, try the Crystal Report forum at http://asp.net.
Title: Exporting to DataGrid in Crystal Reports Asp.Net   
Name: meena
Date: 11/3/2005 8:12:57 AM
Comment:
pls help me,how i connect datagrid to crystal report.
pls give code and demo.
thanking u.
Title: "end of statement expected"   
Name: Richard Dudley
Date: 11/1/2005 1:05:06 PM
Comment:
Gary,

That line should actually be two lines of code:

rptExcel.ExportOptions.DestinationOptions = objOptions

rptExcel.Export()

I'll see if I can get that fixed. Sorry about that.
Title: Mr   
Name: Gary
Date: 10/31/2005 10:55:10 PM
Comment:
Hi,

After the step:
"Add the following lines of code:"

I now get a "End of statement expected" error on the "rptExcel.ExportOptions.DestinationOptions = objOptions rptExcel.Export()" line (on the rptExcel.Export() statement).

Any ideas?

Ta

Gary
Title: Double-byte encoded   
Name: Richard Dudley
Date: 10/20/2005 8:31:09 AM
Comment:
I have no clue how to solve this. You could try the Crystal Reports forum at http://asp.net, but you might want to contact Business Objects. I hope you'll share your answer!
Title: unicode problem   
Name: martin
Date: 10/20/2005 3:09:06 AM
Comment:
Good article!
I have a question: after exporting a report to excel file, the content with double-bytes characters can not be displayed properly.
I think it is because the data fetched from DB is utf-8 encoded while crystal report usese some other encoding to generate the file.
But how can I sovle this problem?

Thanks
Title: what are file formats to be export in crystal reports version 10 and how to export them?   
Name: Imran Basha
Date: 10/15/2005 5:24:05 AM
Comment:
I have already exported PDF and RTF? any one help me how to export "Excel","txt","word"..
Title: Juan   
Name: Richard Dudley
Date: 10/13/2005 10:10:38 AM
Comment:
Juan,

Try asking your question in the Crystal Reports forum at http://asp.net.
Title: Exporting Drill-down data to Excel   
Name: Juan Mazariegos
Date: 10/12/2005 12:45:34 PM
Comment:
Hi,

I found this article useful, now I'm making a drill-down report but the problem I have is when I'm trying to export not only the summary information but the drill-down sections I marked, I need to export this sections too. What do I have to do?

Thanks.
Juan Mazariegos
Title: Tab Separated   
Name: Richard Dudley
Date: 9/22/2005 6:41:59 PM
Comment:
I'm not very familiar with CR XI, but see if there's an option for "use quoted values" or something like that.
Title: Blank Rows   
Name: Richard Dudley
Date: 9/22/2005 6:40:06 PM
Comment:
If you are using a cross-tab report, you will probably not be able to make the columns line up. Otherwise, you need to be extremely careful with the field placements and size.
Title: Blank rows   
Name: Bharat Kumar
Date: 9/22/2005 6:15:41 AM
Comment:
Hi,
Your article was extremely useful. I tried out with my own crystal report and got a problem. There are some extra blank rows and columns , because of which I am unable to sort the columns. Can you help me out of this problem

Thanks
Bharat
Title: Nice Article! But I have few queries more   
Name: Aravind Rajagopal
Date: 9/19/2005 12:39:28 PM
Comment:
Hi! This is pretty useful. I have another frustrating issue with Crystal 11. I need a tab delimited report. But when I Convert using 'ExportFormatType.TabSeperatedText' I get double quotes printed for string values. To eliminate that we converted the report to Excel and then converted into tab separated text. Everything works fine but one of the columns in the report heder is supposed to be '000'. But excel converts that into '0'. This makes the report unusable. Please advise what I should do to eliminate this issue. This is very urgent as the product is already in use.
Quick response is appreciated.
Title: Same column width   
Name: Richard Dudley
Date: 9/16/2005 10:26:11 PM
Comment:
Is the column too wide or too narrow? If too wide, maybe you need to trim the field?
Title: Good One   
Name: Satish
Date: 9/16/2005 12:26:33 AM
Comment:
Hi,

I am using the piece of code given by you with some changes as given below.

Try
'Dim objExcelOptions As ExcelFormatOptions = New ExcelFormatOptions
'objExcelOptions.ExcelUseConstantColumnWidth = False
'rptExcel.ExportOptions.FormatOptions = objExcelOptions
Dim excelFormatOpts As ExcelFormatOptions = ExportOptions.CreateExcelFormatOptions()
Dim exportOpts As ExportOptions = New ExportOptions
excelFormatOpts.ExcelUseConstantColumnWidth = False
exportOpts.ExportFormatOptions = excelFormatOpts
exportOpts.ExportFormatType = ExportFormatType.Excel
oRpt2.ExportToHttpResponse(exportOpts, Response, True, "Exported report")
Catch ex As Exception
'error message
Response.Write("Error Occured : " & ex.Message)
End Try

But this is not working and it is still taking same column width.

Can you please suggest something on this.
my - mail id is satish-shinde@shinsei-it.com
Title: Exporting Subreport   
Name: Richard Dudley
Date: 8/25/2005 4:04:08 PM
Comment:
Vijay,

Try asking your question in the Crystal Reports forum at http://forums.asp.net. It it too complicated to try and fix here.
Title: exporting crystal report to csv format   
Name: Vijay
Date: 8/25/2005 2:04:58 AM
Comment:
while exporting crystal reports to csv format in VB.NET, the subreport data in the main report in not displaying,only main report data is displaying.Plz help.
Title: .net   
Name: prakash
Date: 8/20/2005 3:20:54 AM
Comment:
its very good
Title: Where to find help   
Name: Richard Dudley
Date: 8/19/2005 9:29:08 AM
Comment:
If you have a specific problem, please visit the Crystal Reports forum at http://forums.asp.net.
Title: Exporting to Excel in Crystal Reports .NET   
Name: MK
Date: 8/19/2005 3:59:14 AM
Comment:
My crystal report generated is having two parameters. While exporting the report to excel format, it is giving error as not mentioned the parameters. Please write how to pass parameters while exporting to excel.

mk.das@nic.in
Title: Missing Parameter   
Name: Richard Dudley
Date: 8/1/2005 10:55:13 PM
Comment:
Chandra,

This error means your report is expecting a parameter which you are not setting the value for. Go to http://forums.asp.net and try asking for help in the Crystal Reports forum there.
Title: Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports   
Name: Chandra Mouli Terli
Date: 8/1/2005 3:17:11 AM
Comment:
When I am exporting crystalReport to Excel using the code given by you, i am gettin a error meage "Missing parameter field current value" (this error is fired when rptExcel.Export() is executed).
Please help me fast.
Title: Very nice Material   
Name: Jagdish Sakhiya
Date: 6/23/2005 5:33:38 AM
Comment:
Hi,

I got so much help from this atricles..
Thanks a lot.
Title: Creating a Crystal Report from excel   
Name: baiju
Date: 6/3/2005 7:16:34 AM
Comment:
how u create a crystal report from excel spread sheet ??
Title: Creating a Crystal Report from excel   
Name: baiju
Date: 6/3/2005 7:12:07 AM
Comment:
how u create a crystal report from excel spread sheet ??
Title: Excel sheet is not refreshing   
Name: Asha
Date: 6/3/2005 5:49:30 AM
Comment:
Great Article,but i hav one problem.I hav to display values in excel sheet according to a select query..but the values ones displayed are not changing,thats i am changing the report source query in abutton click,but its not changing..y?can u help me
ashas_asha@rediffmail.com
Title: Exporting to Excel in Crystal Reports.NET, how to export figures as numbers ?   
Name: Siri U. Haugen
Date: 5/11/2005 8:25:32 AM
Comment:
When it comes to exporting number/figures to Excel the users often want to make calculations to the figures, ex. make a sum total in the Excel sheet. Can figures be exportes as numbers into the excel file? How ?
Title: LVExportManager.ocx Problem   
Name: Absar
Date: 5/9/2005 8:10:57 PM
Comment:
Where can I find a new verion of LVExportManager.ocx?
Thanks
Title: Seek help at AspAdvice.com   
Name: Richard Dudley
Date: 5/9/2005 11:50:55 AM
Comment:
Asbar,

Try asking this question to the Crystal Reports list at http://aspadvice.com/SignUp/list.aspx?l=181&c=11.
Title: Why getting blank excel file?   
Name: Absar
Date: 5/6/2005 3:24:32 PM
Comment:
Why getting a blank excel file when export from Crytal?
All users have Excel 2003, and one of them working fine and three of them not working. All using crviewer.dll
Title: Logon failed in rptExcel.Export()   
Name: Alps
Date: 4/29/2005 7:22:15 AM
Comment:
HI Richard

I have tried this code and also read your blogs but still
i m getting error
Logon failed for statement rptExcel.Export().

Please Help..
Title: Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports   
Name: Bhawna
Date: 4/7/2005 8:47:38 AM
Comment:
Excel toolbar not displaying when the report is exported to Excel format.How can the toolbar be displayed?
Title: how to export from vb.net code to excel   
Name: bongs
Date: 4/4/2005 2:03:23 AM
Comment:
i'm trying to export from my programme to excel writing in vb.net
Title: Max # of Rows in Excel   
Name: Richard Dudley
Date: 3/7/2005 9:22:30 AM
Comment:
See this blog post: http://blogs.aspadvice.com/rjdudley/archive/2005/03/07/3002.aspx
Title: Max row length   
Name: Nagraj Prabhu
Date: 3/7/2005 6:18:05 AM
Comment:
How do we trap max row length error that excel gives when we export report from anything to excel?
excel allows maximum of 64K rows in a spreadsheet. how to over come this problem? any ideas?
Title: Exporting to Excel Crystal Reports .Net - Pefect Example   
Name: marcus
Date: 2/25/2005 6:08:04 AM
Comment:
Thnx for the help! Its a nice trivia!
Title: Data only - no footers   
Name: Elaine
Date: 1/17/2005 10:36:10 AM
Comment:
Is there any way to stop the footers from being printed in the excel export? I'm using CR.NET and need a continuous flow of data in the excel spreadsheet.

Please let me know.
Title: How to Export Crystal Report into given Excel Format   
Name: Surya
Date: 12/15/2004 1:53:06 AM
Comment:
Hi,
I want to Export Crystal Report to the given Excel format please suggest how i can do it
Title: It is very Good Article   
Name: Shesham Ravi
Date: 12/15/2004 1:49:22 AM
Comment:
It is good article for Exporting Crystal Report to Excel Format
Title: CrystalDecisions.Shared.ExportFormatType.ExcelRecord   
Name: Richard J. Dudley
Date: 12/13/2004 3:39:54 PM
Comment:
"CrystalDecisions.Shared.ExportFormatType.ExcelRecord" is a CR10 attribute, and isn't available in CR.NET. Sorry.
Title: Happier Excel Formatting   
Name: DS
Date: 12/13/2004 1:53:49 PM
Comment:
Hope this is of use to some of you out there that are having the same problems I had with Excel exports.

I'm not sure if this option is only available as a result of our upgrade to CR v.10 (because I don't remember what CR for VS.NET did), but I was much happier with the formatting of my Excel exports when I used

CrystalDecisions.Shared.ExportFormatType.ExcelRecord;

as my Export Type.

There are no goofy empty rows, wrapping issues, superfluous columns and all the gridlines were visible. It just produces a nice, clean, Excel sheet.
Title: Cell Borders   
Name: Richard Dudley
Date: 12/7/2004 9:04:34 AM
Comment:
I have the solution to the cell borders. please see the blog post below:

http://dotnetjunkies.com/WebLog/richard.dudley/archive/2004/08/11/21751.aspx
Title: Column borders ???   
Name: Rizwan Ahmed
Date: 12/7/2004 12:41:17 AM
Comment:
Can you help me in setting column borders of the exprted excel file.

Waiting for your reply ...
Title: Nice and Very Usefull article   
Name: Soumen
Date: 11/4/2004 6:56:00 AM
Comment:
Its a nice and usefull article and i am sure those devlopers who frequently need to transfer their informations between crystal report and excel sheet will be immensely beneficiated.
Title: Cannot expand table name nodes in Select expert   
Name: Vishnu
Date: 11/2/2004 8:00:57 AM
Comment:
Cannot expand the table name nodes to display
the column name nodes in Select expert, group
expert or the record sort expert. The `report
field` node also does not get expanded.

However these operations do work in Formula
Workshop.
Title: Exporting to Excel nice and PDF wrong   
Name: Nixon Morales
Date: 10/19/2004 1:28:43 PM
Comment:
This article is fine, and is right, CR10 make a perfect excel exports. but I tried to PDF and work in xp or 2000 SO perhaps in Win 2003 the file is created and user see an error message like "too much colors defined" or something else.
Title: Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports   
Name: Anurag
Date: 10/2/2004 5:00:23 AM
Comment:
This is Very good and useful article, It's run without changing a single line of code
Title: Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports   
Name: Jags
Date: 9/15/2004 10:10:11 PM
Comment:
Its a great article , thank you.
I have a question, i am using .net 2003 with crystal 9.x
While exporting the crystal report how can I export/pass page/print set up?
I tried to use,
crystalreport1.printoptions.orientation = landscape ... but no luck.
Could you guide me?
Please reply me at
jags26@rediffmail.com

thanks
Title: Reports with Subreports   
Name: Richard Dudley
Date: 9/15/2004 12:55:10 PM
Comment:
I received a question regarding subreports. The main report exported fine, but the subreport did not. As it turns out, the actual sub report needs to be perfectly in line with the main report. In design mode, you need to stretch the right and left edges of the subreport so they reach the same edges of the main report. And, the fields in the subreport need to be aligned nicely as well with the fields in the main report (this make take a little effort).
Title: Excellent and useful   
Name: Mayank J Patel
Date: 9/9/2004 7:08:09 AM
Comment:
Hi this is mayak Patel .Net Profesional

This is nice Article and very useful for programmer who would like to export with format in excel

Thanks a lot
Mayank Patel
Title: Great article - thx   
Name: Michal Rorat
Date: 9/6/2004 3:35:12 AM
Comment:
it was that something I need :) You saved my life with this formating tutorial :)
Title: Good!!   
Name: Vaibhav Vyawahare
Date: 8/18/2004 5:02:14 AM
Comment:
Whole article provide the complete solution instead of having pain to export to excel.
Title: how to export into more than one excel sheet   
Name: Richard Dudley
Date: 8/16/2004 9:07:37 AM
Comment:
The best place to seek help is the Crystal Reports forum at http://www.asp.net/Forums/ShowForum.aspx?tabindex=1&ForumID=76.

You cannot do what you are asking in Crystal Reports .NET. I do not know at this time if you can do so in Crystal Reports 10, but I will do some research.
Title: Logon Failed Error   
Name: Richard Dudley
Date: 8/16/2004 9:04:57 AM
Comment:
For this error, make sure your logon problem is not a database login issue. Test this by generating your report in a CrystalReportViewer. If your problem is a database issue, read Eric Landes' article on this site at http://aspalliance/490.

If your report generates correctly in a CrystalReportViewer, but you get the error when you export, please see if this blog entry helps:
http://dotnetjunkies.com/WebLog/richard.dudley/archive/2004/06/02/15093.aspx

If you have continued problems, visit the Crystal Reports forum at http://asp.net.
Title: how to export into more than one excel sheet   
Name: Manjunath S
Date: 8/16/2004 2:55:39 AM
Comment:
I have two different RPT files but i need to export these two RPT files in to single EXCEL file having two sheets containing each RPT .

is it possible? if possible how

manjunath15@gmail.com
Title: Logon Failed Error   
Name: Aruna K
Date: 8/13/2004 2:56:19 AM
Comment:
after trying this code i m getting error
Logon failed for statement rptExcel.Export().
Please help
Title: Displaying Gridlines   
Name: Richard Dudley
Date: 8/11/2004 4:59:10 PM
Comment:
I have not found a way to make the gridlines display in the exported Excel worksheet. About the best thing I can come up with at this time is using borders. See my blog post for more information:
http://dotnetjunkies.com/WebLog/richard.dudley/archive/2004/08/11/21751.aspx
Title: Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports   
Name: Mario
Date: 8/11/2004 3:43:57 PM
Comment:
Great article. Helped us fixed an incredibly frustrating problem with Crystal.

Product Spotlight
Product Spotlight 



Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2014 ASPAlliance.com  |  Page Processed at 8/23/2014 11:19:22 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search