Render 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.
You can retrieve data stored in the form of XHTML documents stored in a database CLOB column and render the markup in the generated 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.
Note that when you use html2fo
to display a string containing the ‘< ‘character, the output doesn't display the ‘< ‘ character and the succeeding characters in the string because html2fo
considers the ‘< ‘ character as start of a tag.
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?>