SAP Knowledge Base Article - Public

1400657 - Export to CSV result is different from Crystal Reports for Eclipse than from Crystal Reports

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

  1. Download and install the latest version of Crystal Reports for Eclipse (2.0, sp2).
  2. 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.
  3. In the completed project, in the WebContent folder, expand the Sample Reports folder; you should see 4
    sample reports.
  4. Right click on a sample report and choose Crystal Reports -->Create Report Viewer JSP.
  5. Select the Insert Crystal Reports code snippets to…. (Radio button).
  6. Choose Export report to: CSV (from the drop down).
  7. Once the JSP file has been created, right click on the file and choose Run on server.
  8. Choose to save the resulting CSV file to your desktop.
  9. 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