Home > Building an Application > Creating Reports > Configuring Printing for Re...
Configuring Printing for Reports |
![]() Previous |
![]() Next |
You can set up an application so that end users can print reports in these ways:
Report Regions - You can enable the printing of a report region by configuring the Printing Attributes for the region. These settings apply only to that specific region and cannot be used outside the context of the region.
End users can download and print the report they see on the page and the report is formatted using report layouts designed for printing.
Report Queries - You can set up the printing of a report resulting from queries you set up under Shared Components. Unlike SQL statements contained in regions, these shared Report Queries are stand-alone SQL statements that are validated when you save the query. They must be SQL statements, not functions returning SQL statements.
You can associate a report query with a report layout and download it as a formatted document. The reports can include session state of the current application.
For these reports to be available to end users, you need to integrate them with an application. For example, you can associate a report query with a button, list item, branch, or other navigational component that allows you to use URLs as targets. Selecting that item then initiates the printing process.
Both report regions and report queries can be downloaded in the following formats:
RTF - Compatible with Microsoft Word.
XLS - Compatible with Microsoft Excel. Note that this is not a true .xls
file because the content is HTML-based.
HTML
For more information about the report printing functionality, go to:
http://www.oracle.com/technology/products/database/application_express/index.html
Topics:
See Also: To use the full functionality of report printing, your Oracle Application Express service administrator must enable it for your site. See "Configuring Report Printing". |
To format either a 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.
Application Express provides a lot of flexibility when creating and using report layouts:
You can take advantage of the default (for report regions) and generic (for report queries) layouts provided with Application Express.
Using the built-in XSL-FO based layouts for report regions, you can copy and customize the code. You can edit a number of attributes for report regions that control page size, fonts, colors, and so on.
You can create RTF or XSL-FO report layouts to customize the report look and feel. To use RTF report layouts, your Oracle Application Express service administrator must select the Advanced setting for your site.
Note that the availability of the Report Query options depends on how your service administrator configured the report printing settings at your site. All options described in these steps may not be available to you.
To create a report query:
Navigate to the Shared Components page. See "Accessing the Shared Components Page".
Under Reports, click Report Queries.
Click Create.
For Query, specify the following information:
Name - Enter a name for your report query.
This name will be part of the request string in the URL used to download the report query.
SQL Query - Enter a SQL statement directly or click Query Builder to build a SQL statement by clicking and pointing.
To reference applications and page items in the SQL statement, reference them as bind variables.
Click Next.
To test the query, click Test Query. Testing the report query ensures that the desired result set is returned.
If you include bind variables, you are able to set test values before running the query. The test values are then used in subsequent steps in this wizard, when exporting the XML structure of your report query and to download a formatted test version of your report query.
After you test the query, click Next.
(Optional) For Include Session State, specify the following:
To include a session state, click the up arrow and select an item from the list.
Use a session state item to show additional data along with your report. For example, select an item to display a customer address to display that information on an order form. The order header information is shown along with order details.
Click Add to move the item to the box.
Click Next.
For Download XML, follow the on-screen instructions.
For Confirm:
Query Name - Identifies the query.
Report Layout - Identifies the report layout you selected.
Output Format - Select the format for this report query.
(Optional) Item - Select the item to hold the format information.
URL - To integrate this report with your application, use the displayed URL as the target for a button, list item, link, or other navigational component. This enables end users to click a button, for example, to start the printing process.
Test Report - Click this to preview your report.
Click Finish.
The Report Query is created and saved to Shared Components.
To edit a report query:
Navigate to the Shared Components page. See "Accessing the Shared Components Page".
Under Reports, click Report Queries.
On the Report Queries page, you can use the Navigation bar at the top of the page to search for a query by name or change the page display. For example, you can change the default display by making a selection from View list. Available options include:
Icons (the default) displays each query as a large icon. To edit a query, click the appropriate icon.
Details displays each query as a line in a report. To edit a query, click the name.
Edit the information.
To export the report as XML, click the link in the Tasks list.
Click Apply Changes.
To copy a report query:
Navigate to the Shared Components page. See "Accessing the Shared Components Page".
Under Reports, click Report Queries.
On the Report Queries page, click Copy.
On the Copy Report Query, select the query you want to copy, enter a new name for the copy, and click Copy.
The new copy appears in the query list.
Create report layouts to associate with a report query or report region. You can create a new report layout based on one of these options:
Generic Columns - A generic report layout works with most query result sets. With this layout, the number of columns is automatically adjusted when generating the printable document.
A number of report layout attributes can be defined declaratively for report regions using the built-in XSL-FO default layout. This step allows for creating customizable copies of the built-in default XSL-FO layout, if additional control over the report layout is needed.
Named Columns - A named column report layout is a query-specific report layout designed to work with a defined list of columns in the query result set. This type of layout is used for custom-designed layouts when precise control of the positioning of page items and query columns is required.
Note that the availability of the Report Layout options depends on how your service administrator configured the report printing settings at your site. All options described in these steps may not be available to you.
To create a report layout:
Navigate to the Shared Components page. See "Accessing the Shared Components Page".
Under Reports, click Report Layouts.
Click Create.
The Create Report Layout wizard appears.
For Layout Type, select an option and click Next:
Generic Columns (XSL-FO) - This layout is pre-populated with a default template, which you can edit to fit your needs.
Named Columns (RTF) - This layout is uploaded as an RTF file.
Named Columns (XSL-FO) - This layout is uploaded as an XSL-FO file.
For Layout Source, review and edit the appropriate information. The options that appear on this page depend on the layout type you select:
If you selected Generic Columns:
Report Layout Name - Enter a name to identify the report layout when associating it with a report query or report region.
Report Layout - The report layout is the XSL-FO based definition of the page formatting. All attributes defining page size, orientation, fonts, styles, and so on, are defined in this section.
To see a list of valid substitution strings and other information, click the item label, Report Layout. This opens a separate Help window.
Report Column Heading - Defines the look of each cell in the report heading row.
Report Column - Defines the look of each cell for all report rows.
Report Column Width - This width is computed at runtime time or can be derived from the report column definition of a report region.
If you selected Named Columns:
Report Layout Name - Enter a name to identify the report layout when associating it with a report query or report region.
Upload the file containing the report layout.
You can edit a generic column report layout directly in Application Express. However, to edit a named column report layout, you need to download the current file, edit it, and then upload it again.
To edit a report layout:
Navigate to the Shared Components page. See "Accessing the Shared Components Page".
Under Reports, click Report Layouts.
On the Report Layouts page, select the layout you want to edit.
For generic column layouts, edit the layout directly on the Edit Report Layout. Then click Apply Changes.
For named column layouts, click Download and save the file to your computer.
Edit the file and then upload the updated version as a new report layout.
You can copy a report layout to edit and save.
To copy a report layout:
Navigate to the Shared Components page. See "Accessing the Shared Components Page".
Under Reports, click Report Layouts.
On the Report Layouts page, click Copy.
On the Copy Report Layout page, select the layout you want to copy, enter a new name for the copy, and click Copy.
The new copy appears in the layout list.
To download or print report regions in the supported formats, you need to follow these general steps:
Select the page containing the report region you want to set up.
Create or select a region of type Report.
A report query, based on a standard SQL query whose results appear in your report, must be associated with this region.
Enable report printing for that region.
You must select this option. For the remaining steps in this task, you can accept the defaults or select different options.
Select an output format.
Associate a report layout with the report region.
The default report layout includes a Print link that appears under the report. You can replace that with your own custom button.
Set up other printing attributes, such as the paper size, orientation, header and footer.
If you use the default report layout, the end users click the Print link to initiate the print process.
If the printing feature is set up for your site, you can configure a report region to print in various formats.
To configure a report region for printing:
In your application, select the page containing the report region you want to print.
The Page Definition appears.
Under Regions, click Report next to the region you want to print.
Click the Print Attributes tab.
Under Printing, specify the appropriate information:
Enable Report Printing - Select Yes.
Link Label - Enter the text for the link that starts the printing process.
(Optional) File Name - Enter a name for the downloaded file. If you leave this blank, the region name is used as the file name.
Output Format - Select an output option.
Item - If you select Derive from Page Item, select the item.
Report Layout - Select Default Report Layout or an available report layout you or your administrator created.
In the remaining sections, define page size, paper orientation, page headers and footers, fonts, text color, and background color.
Click Apply Changes.
If you used the default template, end users can click a Print link to print the report in the format you specified for this region.