Exporting the report results to a CSV file

When exporting the results of a report tab in a page report to a CSV file, you can set the property Columned to decide whether to export the results to a general CSV file or a columned CSV file. If you set the property to false, the report tab will be exported to a general CSV file. If you want to export the report tab to a columned CSV file, set the property to true.

The following is an example about exporting a page report tab to a general CSV file:

  1. In JReport Designer, open the page report that contains the report tab you want to export.
  2. On the report tab bar, click the report tab.
  3. In the Report Inspector, select the root node that represents the report tab and set the property Columned to false.
  4. Click File > Export To > Text to bring up the Export to Text dialog. See the dialog.
  5. Specify the destination of the exported file as required.
  6. Check Delimited Format checkbox, and then select CSV Delimited from the Format drop-down list.
  7. To enable records to be aligned well in the exported file, you are recommended to check Use Quote Mark. Otherwise, the commas in data values such as $78,321.00 will conflict with the delimiter (comma), and may potentially cause the data to be separated incorrectly when the exported file is further processed by other applications. The following shows an example:

    Scarsdale,The Java King,(914) 657-9823,(914) 657-8745,$78,321.00

    As shown above, it is difficult to determine whether the value is $78321.00 or $78 and 321.00.

  8. Check Run Linked Report if you want to include the linked reports in the exported Text result.
  9. Click OK to start exporting.

See also Export to Text dialog for details about options in the dialog.

When exporting a page report tab to a CSV file, you may want to export only some of the objects in the report tab instead of the whole report tab. To achieve this, you can do it as follows:

  1. In the Report Inspector, select the node that represents the object you want to export to the result file.
  2. Set the property Export to CSV of this object to true.
  3. Repeat the above steps to specify other objects that you want to export.
  4. Set this property to false for all the other objects that you do not want to export.
  5. Click File > Export To > Text.
  6. In the Export to Text dialog, specify the directory and name of the exported file.
  7. Make sure that you have checked the Delimited Format box, and selected CSV Delimited format.
  8. Check Run Linked Report if you want to include the linked reports in the exported Text result.
  9. Click OK to start exporting.

Then, the exported file will only contain objects whose Export to CSV property value has been set to true. Note that if you set the Export to CSV property of an object to false, all the object's children will not be exported regardless of their individual Export to CSV properties.

Notes: