Index

Exporting to Text

To export a text file in JReport Designer, on the File menu, point to Export, and then click To Text. The Export to Text dialog appears.

The Export To Text dialog includes the following screen elements:

Export to
Type the file name and directory where you want to store the exported text file or click the Browse button to specify the directory.

Standard Data Format
This section allows you to specify the format in the following options.

Format
You can specify a delimiter to separate fields. Select one from the drop-down list.

CSV Delimited - Fields in the exported text file will be separated by commas.
Tab Delimited - Fields in the exported text file will be separated by tabs.
Custom Delimited - Fields in the exported text file will be separated by a user defined delimiter. You can type your own delimiter in the Delimiter box.

QuoteMark
If checked, fields in the exported text file will be marked with quotation marks.

Header and Footer
If checked, the exported file will contain all headers and footers in the report, including Report Header/Footer, Page Header/Footer and Group Header/Footer. Otherwise, the exported file will only contain data in the Detail section.

Repeat last column value if null
If checked, when a certain field has no value, it will repeat the data of the previous record.

User Define Density
This section allows you to specify the density for the exported text file content.

Horizontal Density
Type a value for each unit of the horizontal density between columns. The density of the result is in direct ratio to the value you specified. That is to say, the greater the value is, the smaller the width between columns. The default value is -1.

Vertical Density
Type a value for each unit of the vertical density between columns. The density of the result is in direct ratio to the value you specified. That is to say, the greater the value is, the smaller the height between columns. The default value is -1.

Compress
If checked, there is no clearance between columns. Please note that, this option works only when no any data (including empty strings) display in a row (since JReport Designer v4.5).

Resolution
Specify resolution as you desired. When the value is -1, it will use the current resolution of your monitor.

Use Windows end-of-line characters
Specifies whether to use Windows end-of-line characters to indicate the start of a new line. If checked, it uses two characters at the end of the line: <cr><lf>. Otherwise, it uses Unix EOL character: <lf>, at the end of line.

Example: Exporting a report to CSV File

The following case is a simple example to show you how to export your report to a csv format file:

  1. Open the report to be exported. Here we select the demo report Lesson2.cls under %Intall_Root%\demo\reports.
  2. On the File menu, point to Export, and then click To Text.
  3. Specify the destination of the exported file: C:\rptcsv\lesson2.csv. Check Standard Data Format, select CSV Delimited from the Format drop-down list.
  4. To have records aligned well in the exported file, you are suggested checking QuoteMark. If not, the commas in the data value like "$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.

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

    As shown above, it's hard to determine whether the value is $78321.00 or $78 and 321.00.
  5. Click OK to perform the exporting operation.

Notes:

To improve the performance of running report to the Standard Data Format on JReport Enterprise Server

On JReport Enterprise Server, if you want to improve the performance of running a report to the Standard Data Format, such as the CSV format, some settings should be done in JReport Designer first and then deploy the report to JReport Enterprise Server to run it to the Standard Data Format. Please follow the steps below:

  1. Open the report you want to run to the Standard Data Format on the server in JReport Designer. In Report Inspector, browse to the root node of the report, find the two properties FastPass and Columned, and then set them to true.
  2. Choose the object you want to display in the result file and set where you want them to be shown in the result file. To do this, select the object, and find the two properties ColumnIndex and RowIndex. The ColumnIndex refers to which column this object will be in and the RowIndex refers to which row this object will be in in the result file. The number of the column and the row are started with 0 and counted within its section, for example, if you want to place the object in the first column and the second row in the detail section, set ColumnIndex = 0 and RowIndex = 1 of this object.

    Note: This method can also be used in JReport Designer to improve the performance when export the report result to Standard Data Format.
  3. Please go to the server.propertise file under %JREntServer_InstallRoot%\bin to change the property engine.single_thread = false. This enables the property FastPass to take effect when running the report to the Standard Data Format.
  4. Deploy the report to JReport Enterprise Server, when you run or schedule the report, after you choose the To Text format, please select the Standard Data Format check box, and then click Submit to generate the Standard Data Format file.

Notes:

Related Topics

Exporting to JReport Result
Exporting to HTML
Exporting to PDF
Exporting to Fax
Exporting to Postscript File
Exporting to Mail
Exporting to Applet
Exporting to RTF
Exporting to Excel File
Exporting to XML

Index