This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Java Products and Servers and the fly likes jsp crystal reports xls Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "jsp crystal reports xls" Watch "jsp crystal reports xls" New topic
Author

jsp crystal reports xls

Hugo de la Mora
Greenhorn

Joined: Jun 29, 2002
Posts: 14
Hi, does anyone knows how to export data to Excel from JSP using Crystal Reports, thx in advance.
Hugo de la Mora
Greenhorn

Joined: Jun 29, 2002
Posts: 14
here is my code

<%@ page import="com.crystaldecisions.report.web.viewer.*,
com.crystaldecisions.reports.reportengineinterface.*,
com.crystaldecisions.sdk.occa.report.data.*,
com.crystaldecisions.sdk.occa.report.reportsource.*,
com.crystaldecisions.sdk.occa.report.exportoptions.*" %>

<%
String report = "test3.rpt";

IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
IReportSource reportSource = (IReportSource)
rptSrcFactory.createReportSource(report, request.getLocale());

try{
ReportExportControl expControl = new ReportExportControl();

ExportOptions exOpts = new ExportOptions();
//exOpts.setExportFormatType(ReportExportFormat.RTF);
//exOpts.setExportFormatType(ReportExportFormat.recordToMSExcel);
exOpts.setExportFormatType(ReportExportFormat.MSExcel);

//RTFWordExportFormatOptions options = new RTFWordExportFormatOptions();
//DataOnlyExcelExportFormatOptions options=new DataOnlyExcelExportFormatOptions();
ExcelExportFormatOptions options = new ExcelExportFormatOptions();

options.setStartPageNumber(1);
options.setEndPageNumber(3);
exOpts.setFormatOptions(options);


expControl.setExportOptions(exOpts);
expControl.setReportSource(reportSource);
expControl.setExportAsAttachment(true);
expControl.setOwnPage(true);
expControl.refresh();
//expControl.processHttpRequest(request, response, config.getServletContext(),out);
expControl.processHttpRequest(request, response,getServletConfig().getServletContext(), null);
expControl.dispose();
}catch(Exception e){out.println(e);}



i'm getting this error
Error
exporterName is empty
what can i do?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

i'm getting this error
Error
exporterName is empty


That is clearly an error being thrown by the code you are calling. You'll need to investigate in what way you are calling it incorrectly.

Since this really has nothing to do with JSP, I've moved it along to the Other Java Products forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Chandra Mohan
Ranch Hand

Joined: Oct 06, 2003
Posts: 62
Hi, I am facing the same problem. I added this but with no effect. Any clue? Thanks in advance,

JPEReportSourceFactory jrsf = new JPEReportSourceFactory();
ExportOptions exOpts = new ExportOptions();
exOpts.setExportFormatType(ReportExportFormat.recordToMSExcel);
//ExcelExportFormatOptions options= new ExcelExportFormatOptions();
DataOnlyExcelExportFormatOptions options=new DataOnlyExcelExportFormatOptions();
options.setMaintainRelativeObjectPosition(true);
options.setExportImages(true);
options.setExportObjectFormatting(true);
options.setMaintainColumnAlignment(true);
options.setExportObjectFormatting(true);
options.setExportPageHeaderAndFooter(true);
options.setUseWorksheetFunctionsForSummaries(true);
options.setBaseAreaType(AreaSectionKind.detail);
exOpts.setFormatOptions(options);
ReportExportControl expViewer = new ReportExportControl();

expViewer.setName("Excel1.xls");
expViewer.setEnableParameterPrompt(true);
expViewer.setExportOptions(exOpts);


expViewer.setReportSource(jrsf.createReportSource("Report.rpt",request.getLocale()));
expViewer.setOwnPage(true);
expViewer.setOwnForm(true);
expViewer.processHttpRequest(request, response, config.getServletContext(),out);
expViewer.dispose();


Thanks and Regards
Chandra Mohan
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jsp crystal reports xls
 
Similar Threads
calling crystal reports using jsp
java reporting tool
crystal reports
Adding reporting functionality to my project
Crystal Reports