• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2841
  • Last Modified:

Export web Crystal Reports XI to Excel

How to export web Crystal Reports XI to Excel? The export option of Excel doesn't show up on my web Crystal Report. My code is as follows :

String reportName = "1308_001.rpt";
Object reportSource = new Object();
//---------- Create a ReportClientDocument ----------
ReportClientDocument oReportClientDocument = new ReportClientDocument();
//Open report.
oReportClientDocument.open(reportName, 0);
//Get the report source
reportSource = oReportClientDocument.getReportSource();
//create the CrystalReportViewer object
CrystalReportViewer oCrystalReportViewer = new CrystalReportViewer();
//set the reportsource property of the viewer
oCrystalReportViewer.setReportSource(reportSource);
//set viewer attributes
oCrystalReportViewer.setOwnPage(true);
oCrystalReportViewer.setOwnForm(true);
//set the CrystalReportViewer print mode
oCrystalReportViewer.setPrintMode(CrPrintMode.ACTIVEX);
...
0
craigyang
Asked:
craigyang
1 Solution
 
habibbCommented:
by using following code you can export report to excel for your web solutions.



CrystalDecisions.Shared.ExcelFormatOptions  objExcelOptions = new CrystalDecisions.Shared.ExcelFormatOptions();
                              objExcelOptions.ExcelUseConstantColumnWidth = true;
                                          
                              m_ReportDoc.ExportOptions.FormatOptions = objExcelOptions;    

                              MemoryStream objStream  = (MemoryStream)oReportClientDocument .ExportToStream(CrystalDecisions.Shared.ExportFormatType.ExcelRecord);
                              Response.Clear();
                              Response.ContentType="application/vnd.ms-excel";
                              Response.BinaryWrite(objStream.ToArray());
                              Response.End();
0
 
craigyangAuthor Commented:
Do you have a solution using JSP?
0
 
frodomanCommented:
>>> The export option of Excel doesn't show up on my web Crystal Report

This normally means that the export dll hasn't been installed on the server...

frodoman
0
 
mlmccCommented:
Check this link.  It indicates you cannot export from JSP to Excel.

mlmcc
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now