Symptom
- CSV export is incorrectly displayed when compared to Crystal Reports designer.
- This initially worked in the earlier version of Crystal Reports for Eclipse (v1.0) and stopped working in version 2.0.
Environment
- Crystal Reports for Eclipse 2.0
Reproducing the Issue
- Download and install the latest version of Crystal Reports for Eclipse (2.0, sp2).
- Create a new Crystal Reports Web Project; use the Tomcat 6 and JDK 6 for your runtime server
components, and include the Sample reports and Database. - In the completed project, in the WebContent folder, expand the Sample Reports folder; you should see 4
sample reports. - Right click on a sample report and choose Crystal Reports -->Create Report Viewer JSP.
- Select the Insert Crystal Reports code snippets to…. (Radio button).
- Choose Export report to: CSV (from the drop down).
- Once the JSP file has been created, right click on the file and choose Run on server.
- Choose to save the resulting CSV file to your desktop.
- Open the file and note how the columns end up displaying in rows instead, and the data is not lined up
correctly.
Cause
- The cause is an incorrect value set for the delimiter in CRJavaHelper.java
- By default in CRJavaHelper.java, CharacterSeparatedValuesExportFormatOptions.setDelimiter takes "\n" as a string parameter to the method
- This causes the rows to be exported as a column, causing the CSV formatting to be incorrect
Resolution
- The Crystal Reports help documentation states that the correct delimiter is either " or '
- In CRJavaHelper.java, Change the "\n" parameter to setDelimiter to "\""
- You may also need to add the following methods:
setReportSectionsOption(ExportSectionsOption.exportIsolated);
setGroupSectionsOption(ExportSectionsOption.exportIsolated);
Keywords
KBA , BI-DEV-JAV , BI Software Development Kits (SDKs) - Java , How To
Product
Crystal Reports for Java 1.0