• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

jsp crystal reports xls

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, does anyone knows how to export data to Excel from JSP using Crystal Reports, thx in advance.
 
Hugo de la Mora
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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();
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic