10.9 Printing Report Regions

You can configure a report region to print by exporting it to several different formats. Oracle BI Publisher supports Adobe Portable Document Format (PDF), Microsoft Word Rich Text Format (RTF), or Microsoft Excel format (XLS), or Extensible Markup Language (XML). Oracle Rest Data Services also supports PDF and XML. If you choose to use other third-party rendering engines, other output formats can also be configured.

By taking advantage of region report printing, your application users can view and print reports that have a predefined orientation, page size, column headings, and page header and footer. Interactive reports also have the ability to export to PDF, RTF, Microsoft Excel and Comma Separated Values (CSV).

Note:

Interactive reports do not support a custom report layout.

Tip:

If you run Oracle Application Express with Oracle Database 11g Release 1 (11.1) or later, you must enable network services to use report printing. See "Enabling Network Services in Oracle Database 11g or Later."

10.9.1 About Printing Reports to PDF

To print a report to PDF, the data must be transformed using a report server defined at the instance-level. From an end user's perspective, they simply click a print link. However, from developer's perspective, you must then declaratively create regions to support PDF printing.

10.9.2 About Report Printing Configuration Options

Oracle Application Express provides three report printing configuration options:

  • Oracle REST Data Services - Select this option if you are using the Oracle REST Data Services (formerly called Application Express Listener) release 2.0 or later. This option enables you to use the basic printing functionality, which includes creating report queries and printing report regions using the default templates provided in Application Express and using your own customized XSL-FO templates.

    Note:

    The Oracle REST Data Services option does not require an external print server, instead the report data and style sheet are downloaded to the listener, rendered into PDF format by the listener and then sent to the client. The PDF documents in this setup are not returned back into the database, thus the print APIs are not supported when using the Oracle REST Data Services-based configuration.
  • External (Apache FOP) - Select this option if you are using Apache FOP on an external J2EE server. This option enables you to use the basic printing functionality, which includes creating report queries and printing report regions using the default templates provided in Application Express and using your own customized XSL-FO templates.

  • Oracle BI Publisher - This option requires a valid license of Oracle BI Publisher (also known as Oracle XML Publisher). This option enables you to take report query results and convert them from XML to RTF format using Oracle BI Publisher. Select this option to upload your own customized RTF or XSL-FO templates for printing reports within Application Express.

    See Also:

    PDF Printing in Application Express to learn more about installing and configuring Oracle BI Publisher. Go to:
    http://www.oracle.com/technetwork/developer-tools/apex/application-express/configure-printing-093060.html
    

To use the full functionality of report printing, your Oracle Application Express service administrator must enable it for your instance. To learn more, see "Configuring Report Printing" in Oracle Application Express Administration Guide.

10.9.3 About Classic Report Printing Methods

There are two ways to print classic report regions:

Both report regions and report queries can be downloaded in the following formats:

  • PDF - Adobe Portable Document Format.

  • RTF - Microsoft Word Rich Text Format.

  • XLS - Microsoft Excel format. Note that this is not a true .xls file because the content is HTML-based.

  • HTML

  • XML - Extensible Markup Language.

To format either a report region or report query, you associate it with a report layout. To learn more, see "Formatting a Report Region or Report Query Using Report Layouts."

Tip:

You can also have the output format specified by an item that determines the output format at runtime. Select the item that holds the format value. Valid values are PDF, RTF (to open the document in Microsoft Word), XLS (to open the document in Microsoft Excel) and HTM (to download the document as an HTML file).

10.9.4 Configuring Classic Report Region Print Attributes

One approach to printing a report region is to configure Print Attributes. Once configured, these attributes only apply only to current region and cannot be used outside the context of the region.

If the printing feature is set up for your instance, you can configure a report region to print in various formats.

10.9.4.1 Configuring a Classic Report Print Attributes in Page Designer

To configure a classic report region for printing:

  1. View the page in Page Designer. See "Viewing a Page in Page Designer."

    Page Designer appears.

  2. Enable the Printing attribute:

    1. View the page containing the classic report in Page Designer. See "Viewing a Page in Page Designer."

    2. In the Rendering tree, expand the region containing the report and select the Attributes node

      The Property Editor displays the report attributes.

    3. In the Property Editor, locate expand the Printing section.

    4. For Printing, Enabled, select Yes.

    5. Click Save and refresh the page.

  3. In the Rendering tree, expand the Attributes node and select the Printing node.

  4. Under Region, select the Attributes node.

  5. Edit the appropriate Printing attributes.

    To learn more, see field-level Help.

  6. To save your changes click Save. To save and run the page, click Save and Run Page.

10.9.4.2 Configuring a Classic Report Print Attributes in Component View

To configure a classic report region for printing:

  1. In your application, select the page containing the interactive report region you want to print.

    The page appears.

  2. Under Regions, click Print link next to the region you want to print.

    The Print Attributes page appears.

  3. Under Printing, specify the appropriate information:

    1. Enable Report Printing - Select Yes.

    2. Link Label - Enter the text for the link that starts the printing process.

    3. Response Header - Specify whether the response header generated by Oracle Application Express is based on your Report Settings or the Print Server. The response header is the information the server sends back to the web browser in response to receiving an HTTP request. It contains the date, size and type of file that the server is sending back to the client and also data about the server itself. To specify content disposition (using the attribute View File As) and file name, the response header must be based on Report Settings.

    4. View File As - Select how the web browser opens the report query document. Options include:

      • Attachment - Displays a File Open/Save dialog box when the user clicks the report query download button.

      • Inline - Displays the report query document inside the Browser window.

    5. (Optional) File Name - Enter a name for the downloaded file. If you leave this blank, the region name is used as the file name.

    6. Output Format - Select an output option.

    7. Item - Only enabled, if you select the Output Format Derived from Item. If enabled, select the application or page item that holds format value.

    8. Report Layout - Select Default Report Layout to use the built-in generic report layout, or an available report layout you or your administrator created.

      For a listing of the supported substitution strings available when building custom XSL-FO report layouts, see field-level Help.

    9. Print Server Overwrite - Specify an alternate print server. A print server is typically configured centrally for all workspaces in Oracle Application Express Administration Services. See "Configuring Report Printing" in Oracle Application Express Administration Guide.

      Configuring an alternative print server at the report level makes debugging and diagnosis of potential printing problems easier and supports the use of specific custom built end points to perform custom XSLT transformations.

    10. Print URL - Report regions can be printed using the standard print link or using a page button. To use a button, remove the Link Label, create a button on your page, and use the URL shown in this attribute as the button target.

  4. In the remaining sections, define page size, paper orientation, page headers and footers, fonts, text color, and background color.

  5. Under Report Columns, specify the width for each column.

    The default is to make each column the same width. The Total Width is a display only field that shows the sum of all column width values. When changing the width for an individual column the Total Width is automatically recalculated. If Column Width Units is set to Percentage, rather than Points, then the total column width must be less than or equal to 100.

    Use the Reset Column Width button to reset the Column Width Units to Percentage and change all column widths back to their default value. The Recalculate button maintains the current ratios between column widths but reduce all column widths such that the Total Width is less than or equal to 100%.

  6. Click Apply Changes.

10.9.5 Configuring Interactive Report Region Print Attributes

Unlike classic reports, the Interactive Report Print Attributes can only use the default XSL-FO layout and is initiated from the Report Attributes, Download section rather than directly from this screen. Once configured, these attributes only apply only to the current region and cannot be used outside the context of the region.

If the printing feature is set up for your instance, you can configure a report region to print in various formats.

10.9.5.1 Configuring Interactive Report Regions for Printing in Page Designer

To configure an interactive report region for printing:

  1. View the page in Page Designer. See "Viewing a Page in Page Designer."

    Page Designer appears.

  2. In the Rendering tree, expand the region containing the report and locate the Attributes node.

  3. Expand the Attributes node and select the Printing node.

    The Printing Attributes display in the Property Editor.

  4. Edit the appropriate Printing attributes.

    To learn more, see field-level Help.

  5. To save your changes click Save. To save and run the page, click Save and Run Page.

10.9.5.2 Configuring Interactive Report Regions for Printing in Component View

To configure an interactive report region for printing:

  1. In your application, select the page containing the interactive report region you want to print.

    The page appears.

  2. Under Regions, click Interactive Report next to the region you want to print.

  3. Click the Print Attributes tab.

  4. Under Printing, specify the appropriate information:

    1. Response Header - Specify whether the response header generated by Oracle Application Express is based on your Report Settings or the Print Server. The response header is the information the server sends back to the web browser in response to receiving an HTTP request. It contains the date, size and type of file that the server is sending back to the client and also data about the server itself. To specify content disposition (using the attribute View File As) and file name, the response header must be based on Report Settings.

    2. View File As - Select how the web browser opens the report query document. Options include:

      • Attachment - Displays a File Open/Save dialog box when the user clicks the report query download button.

      • Inline - Displays the report query document inside the Browser window.

    3. Print Server Overwrite - Specify an alternate print server. A print server is typically configured centrally for all workspaces in Oracle Application Express Administration Services. See "Configuring Report Printing" in Oracle Application Express Administration Guide.

      Configuring an alternative print server at the report level allows for easier debugging and diagnosis of potential printing problems and supports the use of specific custom built end points to perform custom XSLT transformations.

  5. In the remaining sections, define page size, paper orientation, page headers and footers, fonts, text color, and background color.

  6. Click Apply Changes.

10.9.6 About Report Queries

You can print a report region by defining a report query as a Shared Component. A report query identifies the data to be extracted. Unlike SQL statements contained in regions, report queries contain SQL statements that are validated when you save the query. Note that report queries must be SQL statements, not functions returning SQL statements.

10.9.7 About Report Laoyouts

To format either a classic report region or report query, you associate it with a report layout. Using report layouts renders the data in a printer-friendly format. If you do not select a report layout, a default XSL-FO layout is used. The default XSL-FO layout is always used for rendering Interactive Report regions.