6.) The Preview Window

After inserting or manipulating report objects, you can view the results in the preview window.  You can switch back and forth between the design and preview windows by using the tabs in the upper left-hand corner of the Report Designer, or by selecting 'Design' or 'Preview' from the View menu.  The preview window gives you an accurate picture of what the report will look like if it is printed or exported.


Preview Window

The preview shows the page dimensions in inches or centimeters (depending on which unit is selected with the toggle button at the upper left-hand corner of the designer window where the rulers meet.  The drop-down menu at the right-hand side of the toolbar allows you to set the zooming for the preview.

6.1.) Navigating the Report

You can navigate around the report using the toolbar, or the View menu. The toolbar buttons perform the following functions:

 Go to the first page of the report

 Go to the previous page of the report

 Go to a specific page (that you enter in the 'Page' text box.)

 Go to the next page of the report

 Go to the last page of the report

These navigation functions can also be performed by selecting 'First Page', 'Previous Page', 'Next Page', 'Last Page', or 'Go To Page...' from the View menu.

6.2.) Other Preview Window Options

Other options in the preview window toolbar perform the following functions:

 Save the file

 Export the file

 Print the report (This option is unavailable if Report Designer is run as an applet)

  Load the entire report in the page viewer window.  For more on this please see section 6.2.4.

 Refresh Data

In addition, the File, and Data menus remain active, allowing you to manipulate the file, print, refresh data, and view column mappings.

6.2.1.) Preview Data Options

The first time you preview a report, you will be presented with the data options dialog.  This dialog allows you to set several options related to how the preview window displays report data.


Preview Data Options Dialog

The first option allows you to select whether or not to use live data when previewing the report.  If you select live data, then the report will connect to the data source, and retrieve the data every time the report is previewed.  Note that if the data cannot be obtained (for example, if the database connection is down), then the preview will show an error.  You will then need to reload the report (once the connection has been reestablished) or go back to the Preview Data options and select to use saved data.  If you select to use saved data then the report will show whatever data it has when you preview the report.  This could be the two records of back-up data that are stored in the template, the first twenty records that are retrieved when a report is first created, or the full data set from the previous preview (if the option had been set to use live data).

If you elect to use live data to preview the report, a second option can be set that allows you to limit the number of records that should be retrieved from the data source.  If your report uses a large data set, this option allows you to see the report with data while limiting the processing time, and preserving client memory.

Once you set this option the first time a report is previewed, you will not be prompted again when you preview the report.  If you want to change these settings, select "Set Preview Display Options" Data menu.  This will bring up the dialog again, allowing you to change the preview settings.

6.2.2.) Sorting Data

Within the preview window you can sort the data based on any column in the report in ascending or descending order.  To do this, select ‘Sort by (ascend)’ or ‘Sort by (descend)’ from the View menu.  Each option will bring up a secondary menu containing all of the report column fields.  Selecting a column field will cause the report to sort by that column in either ascending or descending order.  This feature is also available in the Report Viewer applet.

To sort by multiple columns, select 'Sort By...' from the View menu.  This will bring up a dialog allowing you to select which columns to sort by, and the direction.


Preview Sorting Dialog

To sort by a column, select it in the left-hand side of the dialog, and click the 'Add' button.  You can set the direction of the sort, by selecting the column in the right-hand side and clicking either the 'Ascending' or 'Descending' button.

*Note - any sorting performed, will not be saved with the template.  When the template is re-opened (run), the data will be in the original order.  You can, however, export the report after sorting, and the exported file will reflect the re-ordered data.

It is not recommended that you use this feature with reports containing a large amount of data, as this will use a large amount of memory, and can compromise performance.

6.2.3.) Parameter Prompts

If your report uses a parameterized query, or if you have defined any formula parameters in the report, you will be prompted to select parameter values when you preview the report.


Parameter Prompt Dialog

Depending on how the parameters are mapped, you are prompted to type in or select the parameter values.  Clicking 'Ok' will generate the report using the specified values.  You can disable parameter prompting by toggling the 'Preview Parameter Prompt' option in the Data menu. If date variables are not mapped to a database column, the parameter prompt will appear as below, with the options of entering a date from the calendar or a date variable.


Date Parameter Prompt Dialog

For more about query parameters, see section 3.2.2.2. For more about formula parameters, see section 8.2.6.

6.2.4.) Using Page Viewer

Generally when you preview the report, the entire report with it's data is kept in memory.  This allows you to quickly preview, and navigate through the generated report.  However, for large reports previewing the entire report could significantly affect system performance as the entire report is loaded in memory.  To prevent this problem, you can limit the number of records that are fetched during preview as detailed in section 6.2.1.

However, when creating an ad-hoc report, you may want to preview the entire report without loading it in memory.  To do this, EspressReport allows you to load the report in the page viewer.  To do this, select 'Launch Page Viewer" from the View menu, or click the 'Launch Page Viewer' icon on the toolbar.  This will open a page viewer window containing the report.


Report Shown in Page Viewer Window

The page viewer window will show the entire report.  You can navigate around the different pages, clicking the buttons on the toolbar at the bottom of the window, or by right-clicking and selecting to change pages from the pop-up menu.  Because the page viewer is a static format the window will not automatically reflect any subsequent changes made to the report.  You will need to close the window and re-launch the page viewer.  For more information about the page viewer, please see Chapter 2 of the Programming Guide.

6.2.4.1.) Unmapped Drilldown Parameter

When viewing a report with unmapped drilldown parameters, clicking on the links in the main report will cause a parameter selection dialog to pop up allowing you to fill in the unmapped parameters.


Parameter Selection Dialog

Once the values are entered, click OK and the drill report will be shown.  To return to the previous level, click on the back button in the page viewer toolbar.


Drill Down Level

6.3.) Setting Page Properties

The output you see in the preview window is based on the page dimensions and margins that are set in the design window.  The page dimensions are marked by the rulers, with the shaded areas indicating the page margins.  To adjust these properties select 'Page Setup' from the 'Option' menu.  This will bring up a dialog box prompting you to set the page orientation (landscape or portrait), height, width, and margins.  Measurements are in inches or centimeters depending on which unit is currently selected.  Changing the orientation will also change the default print properties.


Page Properties Dialog

7.) Saving and Exporting Reports

After you are finished editing the report, you can save it as a template, or export it to HTML, DHTML, PDF, CSV, Excel (XLS), Excel 2007 (XLSX), Text, XML, Rich Text, or View (Page Viewer) format.

7.1.) Saving Reports

You can save the current report by selecting 'Save' or 'Save As' from the File menu, or by clicking on the save button on the toolbar.  All reports are saved as templates either in .rpt (binary) or XML format.  Selecting the save option will simply overwrite the existing file, unless you are working on a new report that has yet to be saved.  Selecting the save as option will bring up a dialog box prompting you to create a file name.  The save as dialog also has several checkboxes.


Save As Dialog

7.1.1.) Changing the Save Location

By default reports are saved/opened from the /templates/ directory.  You can change the default directory by modifying the reportdesigner.bat/.sh file, or modifying the HTML source of the applet page used to launch Report Designer.

To change the default save location, add the following argument to the reportdesigner.bat or .sh file: -templatesDirectory:Path where the path is a directory relative to the root directory of the installation.  For example -templatesDirectory:templates/mytemplates would set the default directory to EspressReportInstallDir/templates/mytemplates.

If you're running Report Designer through an applet, you will need to add the following parameter to the applet HTML page: <PARAM NAME="templates_directory" VALUE="templates/mytemplates">.

7.1.2.) XML Encoding

Both data registry files and report templates in EspressReport can be saved in XML format.  By default both types of files use the Western European encoding.  In order to save data registries (including queries), and report templates correctly in XML, you will need to set the XML encoding to use a different character set.  For more information about using this feature, please see section 1.2.4 of the Internationalization Guide.

7.2.) Exporting Reports

You can export the current report to a variety of formats, directly from the Report Designer.  To export a file select 'Export' from the 'File' menu.  This will bring up a second menu allowing you to select the type of file that you would like to export to: HTML, DHTML, PDF, CSV, Excel (XLS), Excel 2007 (XLSX), text, XML, rich text, or view.  You can also export a file by clicking the export file button on the toolbar.

7.2.1.) PDF Font Mapping

EspressReport allows you to use any font on the system for reports.  For most formatted exports (HTML/DHTML/Rich Text/Excel/Excel 2007) system fonts will translate automatically in the generated output.  (For Rich Text and Excel/Excel 2007, if the fonts cannot be found, they will default to Arial).  For PDF, however you will have to manually specify a .ttf (true type font), .ttc (true type collection), .pfb, or .afm file for any system font that you would like to use in the report.

To set font mapping for PDF export, select 'Font Mapping' from the Option menu.  This will bring up a dialog allowing you to specify font files.


Font Mapping Dialog

For each font and style combination, you can select a specific .ttf, .ttc, .pfb, or .afm file for that font.  You can either type the full path, or browse to the font file.  If your using a .ttc file you will need to specify the font index in the box provided (.ttc files contain more than one font).  Once you have specified the correct file, click the 'Add' button to save the mapping to the list.  You can edit or delete existing mappings, by selecting them in the list, and clicking the appropriate button.

7.2.1.1.) PDF Font Mapping Import/Export

You can pass the font mapping from one report to another using the Import/Export feature.  You can export the font mapping, by clicking the 'Export' button on the font mapping dialog.  This will bring up a dialog box prompting you to specify a file name.  The font mapping will then be saved as an XML file.  You can load a font mapping XML file by selecting the 'Import' option from the dialog.  This will bring up a dialog box prompting you to specify the XML file that you would like to import.  Click on 'OK' and the mapping stored in the XML file will be applied to the current report.

7.2.2.) CSS Options

When exporting a report to DHTML, by default the style definitions are created for each element in the report.  This provides for the fastest exporting.  However, for large reports this can result in a very large file size.  To limit the size of the generated DHTML file, users can select to generate an internal list of global style definitions.  This option is slightly slower, but it produces a significantly smaller file.  In addition, EspressReport provides an option that allows users to apply their own style definitions to report elements by selecting a .css file when exporting the report.

If you are going to use external style sheet definitions, you will need to first select the class name from the external style definitions that should be associated with elements in the report.  To set the class for a report element, right-click on the cell and select 'Set Style Class Name' from the pop-up menu.  This will bring up a dialog allowing you to specify a style name for that report element.


Set Style Class Dialog

Elements for which you do not select a style class will generate their own style based on the settings in the report when the report is exported to DHTML.

Users can also export a .css file for the formatting defined in the report.  These style definitions are the same as would be generated by the internal style sheet option.  This feature can be used to apply formatting created in the Report Designer to other reports, or other Web pages.  To export a .css file from a report, select 'Export Style Sheet' from the Option menu.  A dialog will open prompting you for the name and location for the generated file.

CSS options can be set in the export dialog for the DHTML export.


DHTML Export Dialog

The checkbox marked 'Use Internal Style Sheet' enables/disables the option to generate an internal global list of styles.  The 'Use External Style Sheet' option allows you to specify the location (either relative path or full HTTP path) of a .css file which contains the definitions for the style classes that you have assigned to report elements.

*Note - The formatting from an external style sheet file will only be applied to the DHTML export. Other export formats will use the formatting defined in the report template.