tarekz
asked on
Problems exporting report in Crystal Reports 10
hi,
I am using Crystal Reports 10 (Java Reproting Component).
I made a JSP page to export a rerport to the various available formats.
Only the Word and RTF format are working. All the others (Crystal Reports, Excel, Plain text, etc...) are generating the following exception:
com.crystaldecisions.repor t.web.view er.ReportE xportContr ol
Invalid post back event : {0}
Any ideas?
I am using Crystal Reports 10 (Java Reproting Component).
I made a JSP page to export a rerport to the various available formats.
Only the Word and RTF format are working. All the others (Crystal Reports, Excel, Plain text, etc...) are generating the following exception:
com.crystaldecisions.repor
Invalid post back event : {0}
Any ideas?
ASKER
What is the crystal preview screen? Do you mean the one in the Crystal Reports 10 designer?
Or you are asking about the html page generated by the viewer?
Or you are asking about the html page generated by the viewer?
I am referring to the one in Crystal design mode.
mlmcc
mlmcc
ASKER
Ok, then the answer is yes, i am able to export to all the formats available.
Is the JSP method being run on the same machine or is this on a client?
mlmcc
mlmcc
ASKER
Ok, let me give all the details..
I am running tomcat 4.1.27 on my Machine (it is the application server for my JSP pages)... I am using only the Java Reporting Component... and the reports are all in the .../WEB-INF/classes directory... Probably i should mention that i am able to view them all in the crystal viewer.
Also here is the code of my exportReport.jsp (as i mentioned before, it is working if i choose Word as the format of the export)
<%
String report = (String) session.getAttribute("repo rt");
IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
IReportSource reportSource = (IReportSource)rptSrcFacto ry.createR eportSourc e(report, request.getLocale());
Fields fields = (Fields) session.getAttribute("fiel ds");
String selectedFormat = (String)session.getAttribu te("export Format");
ReportExportControl exportControl = new ReportExportControl();
ExportOptions exportOptions = new ExportOptions();
if(selectedFormat.equals(" 0")/*Cryst al Report*/){
exportOptions.setExportFor matType(Re portExport Format.cry stalReport s);
}
else if(selectedFormat.equals(" 1")/*Word* /){
exportOptions.setExportFor matType(Re portExport Format.MSW ord);
}
else if(selectedFormat.equals(" 2")/*Excel */){
exportOptions.setExportFor matType(Re portExport Format.MSE xcel);
}
else if(selectedFormat.equals(" 3")/*Rich Text Format*/){
exportOptions.setExportFor matType(Re portExport Format.RTF );
}
else if(selectedFormat.equals(" 5")/*PDF*/ ){
exportOptions.setExportFor matType(Re portExport Format.PDF );
}
else if(selectedFormat.equals(" 6")/*Excel without formatting*/){
exportOptions.setExportFor matType(Re portExport Format.rec ordToMSExc el);
}
else if(selectedFormat.equals(" 7")/*Text* /){
exportOptions.setExportFor matType(Re portExport Format.tex t);
}
else if(selectedFormat.equals(" 8")/*CSV*/ ){
exportOptions.setExportFor matType(Re portExport Format.cha racterSepa ratedValue s);
}
exportControl.setOwnPage(t rue);
exportControl.setOwnForm(t rue);
exportControl.setReportSou rce(report Source);
exportControl.setExportOpt ions(expor tOptions);
exportControl.setExportAsA ttachment( true);
exportControl.setParameter Fields(fie lds);
exportControl.processHttpR equest(req uest, response, getServletContext(), out);
exportControl.dispose();
%>
I am running tomcat 4.1.27 on my Machine (it is the application server for my JSP pages)... I am using only the Java Reporting Component... and the reports are all in the .../WEB-INF/classes directory... Probably i should mention that i am able to view them all in the crystal viewer.
Also here is the code of my exportReport.jsp (as i mentioned before, it is working if i choose Word as the format of the export)
<%
String report = (String) session.getAttribute("repo
IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
IReportSource reportSource = (IReportSource)rptSrcFacto
Fields fields = (Fields) session.getAttribute("fiel
String selectedFormat = (String)session.getAttribu
ReportExportControl exportControl = new ReportExportControl();
ExportOptions exportOptions = new ExportOptions();
if(selectedFormat.equals("
exportOptions.setExportFor
}
else if(selectedFormat.equals("
exportOptions.setExportFor
}
else if(selectedFormat.equals("
exportOptions.setExportFor
}
else if(selectedFormat.equals("
exportOptions.setExportFor
}
else if(selectedFormat.equals("
exportOptions.setExportFor
}
else if(selectedFormat.equals("
exportOptions.setExportFor
}
else if(selectedFormat.equals("
exportOptions.setExportFor
}
else if(selectedFormat.equals("
exportOptions.setExportFor
}
exportControl.setOwnPage(t
exportControl.setOwnForm(t
exportControl.setReportSou
exportControl.setExportOpt
exportControl.setExportAsA
exportControl.setParameter
exportControl.processHttpR
exportControl.dispose();
%>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That is true, but they are talking about the export functionality that is within the viewer control itself.
The viewer only supports PDF & RTF. I am using the ReportExportControl which business objects claims it suports all the above mentioned formats (Excel, Word, Crystal Reports, Plain Text, CSV, etc...) except HTML...
Plus the Code i posted is a collection of source code i gathered from the examples they include with their installation.
I dont htink this problem is simple becuase i emailed business objects support and its been 10 days now and they havent replied... :)
I hope you or someone can beat them to the answer!
The viewer only supports PDF & RTF. I am using the ReportExportControl which business objects claims it suports all the above mentioned formats (Excel, Word, Crystal Reports, Plain Text, CSV, etc...) except HTML...
Plus the Code i posted is a collection of source code i gathered from the examples they include with their installation.
I dont htink this problem is simple becuase i emailed business objects support and its been 10 days now and they havent replied... :)
I hope you or someone can beat them to the answer!
Are you sure the constants you are using to set the export format are correct including capitalization?
mlmcc
mlmcc
ASKER
I got word from Crystal Reports That the JRC (Java Reproting Component) only supports RTF and PDF... as we alreay knew, and that even if the ReportExportControl is used, the JRC engine can not handle these other formats.
Glad I could help
mlmcc
mlmcc
Can you export to other formats from the Crystal preview screen?
mlmcc