Rendering HTML Formatted Data in a Report

This section describes how to preserve HTML formatting from a data source in your final output report.

This section contains the following topics:

Supported HTML Features

Using supported HTML features helps you format output for readability and consistency.

Supported HTML features are:

  • Hyperlink

  • List

    • Bulleted list

    • Ordered list

  • Paragraph

  • Font style (bold, italic, plain, underline, subscript, superscript, strike-through)

  • Font size

  • Font family

  • Background color

  • Foreground color

  • Paragraph alignment (center, left, right, and justify)

  • Paragraph indent

The following HTML features are not supported:

  • Nested list (list with indent)

  • Any HTML tags or attributes manually inserted by modifying the HTML source code; for example, inserted tables or images.

Data Model Requirements

The XML data used as input to the report must wrap the HTML portion of the data in a CDATA section.

See Handling XHTML Data Stored in a CLOB Column in the Data Modeling Guide for Oracle Business Intelligence Publisher for information about retrieving the HTML data for display in the report.

RTF Template Requirements

To render the HTML in your report, use the following tag in the RTF template.

The tag is:

<?html2fo: elementname?>

where elementname is the XML element name that contains the HTML data.

Example

This example uses the mentioned XML data with embedded HTML data.

<?xml version="1.0" encoding="UTF-8"?>
<RTECODE>
<![CDATA[
<p><font style="font-style: italic; font-weight: bold;" size="3">
<a href="http://www.oracle.com">oracle</a></font> </p>
<p><font size="6"><a href="http://docs.oracle.com/">Oracle Documentation</a>
</font></p>
]]>
</RTECODE>

To render this sample as formatted HTML a report, enter the following in your RTF template:

<?html2fo: RTECODE?>

The following figure shows how the sample will render in the output report: