Sophie

Sophie

distrib > Fedora > 17 > i386 > by-pkgid > cf79c2d0ed7fa2678c515072ee6f31e4 > files > 107

jasperreports-manual-4.0.2-4.fc17.noarch.rpm

<html xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://jasperreports.sourceforge.net/jasperreports">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JasperReports 4.0.2 - Styled Text Sample</title>
<style type="text/css">
.title {
	font-family: Arial, Verdana, Helvetica, sans-serif;
	font-size: 28px;
	font-weight: normal;
}

.toc {
	font-family: Courier New, Courier, serif;
	font-size: 12px;
	font-weight: normal;
}

.name {
	font-family: Courier New, Courier, serif;
	font-size: 16px;
	font-weight: bold;
}

.label {
	font-family: Arial, Verdana, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	font-style: italic;
}

.description {
	font-family: Arial, Verdana, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: normal;
}

.value {
	font-family: Courier New, Courier, serif;
	font-size: 12px;
	font-weight: normal;
}

.element {
	font-family: Courier New, Courier, serif;
	font-size: 12px;
	font-weight: normal;
}

.attribute {
	font-family: Courier New, Courier, serif;
	font-size: 12px;
	font-weight: bold;
}

.code {
	font-family: Courier New, Courier, serif;
	font-size: 12px;
	font-weight: normal;
}

.copy {
	font-decoration: none;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 8pt;
	font-style: normal;
	color: #000000;
}

.subtitle {
	font-family: inherit;
	font-size: inherit;
	font-style: inherit;
	font-weight: bold;
	text-decoration: none;
	color: inherit;
}

</style>
</head>
<body bgcolor="#FFFFFF">
<a name="top"></a>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td colspan="2" align="right"><span class="element"><a href="../../sample.reference.html">Sample Reference</a> - <a href="../../schema.reference.html">Schema Reference</a> - <a href="../../config.reference.html">Configuration Reference</a> - <a href="http://jasperreports.sourceforge.net/api/index.html">API (Javadoc)</a></span>
<br>
</td>
</tr>
<tr>
<td colspan="2">
<hr size="1">
</td>
</tr>
<tr valign="middle">
<td nowrap="true"><span class="title">JasperReports - Styled Text Sample (version 4.0.2)</span></td><td align="right"><img src="../../resources/jasperreports.png" border="0"></td>
</tr>
<tr>
<td colspan="2">
<hr size="1">
</td>
</tr>
</table>
<br>
<span class="description"><span class="description">Shows how the styled-text feature works in static and dynamic text elements.</span></span>
<br>
<br>
<span class="element"><a href="http://sourceforge.net/projects/jasperreports/files/jasperreports/JasperReports%204.0.2/jasperreports-4.0.2-project.zip/download" target="_blank">Download All Sample Source Files</a></span>
<br>
<span class="element"><a href="http://jasperforge.org/scm/viewvc.php/tags/jr-4-0-2/jasperreports/demo/samples/styledtext/?root=jasperreports" target="_blank">Browse Sample Source Files on SVN</a></span>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 20px;">
<br>
</td><td>
<br>
</td>
</tr>
<tr>
<td colspan="2"><span class="label">Main Features in This Sample</span></td>
</tr>
<tr>
<td>
<br>
</td><td><span class="element"><a href="#styledtext">Styled Text</a></span></td>
</tr>
<tr>
<td colspan="2">
<br>
</td>
</tr>
<tr>
<td colspan="2"><span class="label">Secondary Features</span></td>
</tr>
<tr>
<td></td><td><span class="element"><a href="../markup/index.html#markup">Creating Styled Text Using a Markup Language</a></span></td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><img src="../../resources/px.gif" border="0" width="20" height="1"></td><td><img src="../../resources/px.gif" border="0" width="20" height="1"></td><td><img src="../../resources/px.gif" border="0" width="20" height="1"></td><td><img src="../../resources/px.gif" border="0" width="20" height="1"></td><td width="80%">
<br>
</td><td width="20%">
<br>
</td>
</tr>
<tr>
<td colspan="6" align="right"><a name="styledtext"></a><a href="#top" class="toc">top</a></td>
</tr>
<tr>
<td colspan="6">
<hr size="1">
</td>
</tr>
<tr valign="top">
<td><img src="../../resources/jr-16x16.png" border="0"></td><td colspan="4"><span class="name">Styled Text</span></td><td align="right"><span class="copy">Documented by 
	<a href="mailto:shertage@users.sourceforge.net" class="copy">Sanda Zaharia</a></span></td>
</tr>
<tr>
<td colspan="6">
<br>
</td>
</tr>
<tr valign="top">
<td>
<br>
</td><td nowrap="true"><span class="label">Description / Goal</span></td><td>
<br>
</td><td colspan="3"><span class="description">
How to format text using a styled text tags as markup language.
    </span></td>
</tr>
<tr valign="top">
<td>
<br>
</td><td colspan="1"><span class="label">Since</span></td><td>
<br>
</td><td colspan="3"><span class="description">2.0.5</span></td>
</tr>
<tr>
<td colspan="6">
<br>
</td>
</tr>
<tr>
<td>
<br>
</td><td colspan="5"><span class="description">
<b>Styled Text</b>

<br>

<br>
The text content in text elements can be formatted using 
some particular style attributes such as foreground color, background color, 
font name, font size, font weight, etc. Document styles also contain text formatting attributes (<span class="code"><code>forecolor</code></span>, 
<span class="code"><code>backcolor</code></span>, etc) and can be used to customize the text appearance inside the report element. All these style 
attributes affect the entire text content in the report element.
<br>
But there are situations when one needs to apply a style only to some parts of the text paragraph. Users may want to 
highlight only few words within the text, with no affecting the rest of the paragraph. 
<br>
The solution formerly used was to set the <span class="code"><code>isStyledText</code></span> attribute of the text element. It is now a deprecated 
solution and is replaced by the use of the <span class="code"><code>markup="styled"</code></span> setting.
<br>
If <span class="code"><code>isStyledText="true"</code></span> is set the engine gets notified that the text element contains a structured XML fragment 
with JasperReports proprietary processing rules. 
<br> 

<br> 

<b>Styled Text Markup Tags</b>

<br> 

<br> 
The JasperReports proprietary markup language is called styled text and is an XML 
based format in which the style of any portion of text inside a text element can be 
changed by embedding that portion inside a &lt;style&gt; tag or other simple HTML tag 
from the following list: 
<ul>

<li>
<span class="code"><code>&lt;b&gt;</code></span>
</li>

<li>
<span class="code"><code>&lt;u&gt;</code></span>
</li>

<li>
<span class="code"><code>&lt;i&gt;</code></span>
</li>

<li>
<span class="code"><code>&lt;font&gt;</code></span>
</li>

<li>
<span class="code"><code>&lt;sup&gt;</code></span>
</li>

<li>
<span class="code"><code>&lt;sub&gt;</code></span>
</li>

<li>
<span class="code"><code>&lt;li&gt;</code></span>
</li>

<li>
<span class="code"><code>&lt;br&gt;</code></span>
</li>

</ul>
The <span class="code"><code>&lt;style&gt;</code></span> tag has various attributes for altering the color, font, or other style 
properties of the text. From the standard HTML <span class="code"><code>&lt;font&gt;</code></span> tag, only the fontFace, color, 
and size attributes are recognized by the JasperReports engine. Each individual
style property is inherited from the overall text element or from the parent <span class="code"><code>&lt;style&gt;</code></span> tag
when nested <span class="code"><code>&lt;style&gt;</code></span> tags are used.
<br> 

<br> 

<b>The Styled Text Sample</b>

<br> 

<br> 
This sample contains various styled text paragraphs, illustrating the use of the styled text tags enumerated above.
<br>
The first paragraph is obtained by processing the following fragment:
<pre>
	This is a &lt;style isBold="true" isItalic="true" isUnderline="true"&gt;static text&lt;/style&gt; 
	element containing styled text. &lt;style backcolor="yellow" isBold="true" isItalic="true"&gt;Styled text&lt;/style&gt; 
	elements are introduced by setting the &lt;style forecolor="blue" isItalic="true"&gt;markup&lt;/style&gt; attribute 
	available for the &lt;style isBold="true" forecolor="magenta"&gt;textElement&lt;/style&gt; tag to 
	&lt;style forecolor="red" isItalic="true"&gt;styled&lt;/style&gt; and by formatting the text content using nested 
	&lt;style isBold="true" forecolor="green"&gt;style&lt;/style&gt; tags and simple HTML tags.	</pre>
The next one is obtained by processing the following fragment:
<pre>
	This text field element contains styled text displaying the text-only version of the 
	&lt;style size=\"12\" isBold=\"true\" forecolor=\"black\"&gt;^&lt;style forecolor=\"#808080\"&gt;Jasper&lt;/style&gt;
	&lt;style forecolor=\"#990000\"&gt;Reports&lt;/style&gt;&lt;/style&gt; logo and some &lt;font size=\"10\"&gt;&lt;sup&gt;superscript&lt;/sup&gt;&lt;/font&gt; 
	text and &lt;font size=\"10\"&gt;&lt;sub&gt;subscript&lt;/sub&gt;&lt;/font&gt; text.</pre>
Then the text in the left column is obtained by processing the following fragment:
<pre>
	Here is the list with the attributes supported by the &lt;style isBold="true"&gt;style&lt;/style&gt; 
	tag used to format the text content inside a styled text element:
	
	fontName
	&lt;style size="32"&gt;size&lt;/style&gt;
	&lt;style isBold="true"&gt;isBold&lt;/style&gt;
	&lt;style isItalic="true"&gt;isItalic&lt;/style&gt;
	&lt;style isUnderline="true"&gt;isUnderline&lt;/style&gt;
	&lt;style isStrikeThrough="true"&gt;isStrikeThrough&lt;/style&gt;
	pdfFontName
	pdfEncoding
	isPdfEmbedded
	&lt;style forecolor="red"&gt;forecolor&lt;/style&gt;
	&lt;style backcolor="blue" forecolor="white" isBold="true"&gt;backcolor&lt;/style&gt;</pre>
The text in the column to the right is obtained by processing the following fragment:
<pre>
	Here is the list with the supported HTML tags :
	
	&lt;font size="12"&gt;&amp;lt;font size=&amp;quot;12&amp;quot;&amp;gt;&lt;/font&gt;
	&lt;font color="red"&gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;&lt;/font&gt;
	&lt;font face="DejaVu Serif"&gt;&amp;lt;font face=&amp;quot;DejaVu Serif&amp;quot;&amp;gt;&lt;/font&gt;
	&lt;b&gt;bold &amp;lt;b&amp;gt;&lt;/b&gt; &lt;i&gt;italic &amp;lt;i&amp;gt;&lt;/i&gt; &lt;u&gt;underlined &amp;lt;u&amp;gt;&lt;/u&gt;
	an empty line follows (&amp;lt;br/&amp;gt;):
	&lt;br/&gt;
	&lt;sup&gt;&amp;lt;sup&amp;gt;&lt;/sup&gt; and &lt;sub&gt;&amp;lt;sub&amp;gt;&lt;/sub&gt;
	&lt;br/&gt;
	A bulleted list:
	&lt;li&gt;item 1 &amp;lt;li&amp;gt;&lt;/li&gt;</pre>
The next paragraph is obtained by processing the following fragment:
<pre>
	ampersand &amp;amp; less &amp;lt; greater &amp;gt; quote &amp;quot; apostrophe &amp;apos;</pre>

<pre>
	ampersand &amp;amp; less &amp;lt; greater &amp;gt; quote &amp;quot; apostrophe &amp;apos;</pre>
And the last fragment is obtained by processing the following:
<pre>
	&lt;style size=\"16\"&gt;1&lt;/style&gt;\n&lt;style size=\"24\"&gt;2&lt;/style&gt;\n&lt;style size=\"32\"&gt;3&lt;/style&gt;\n
	&lt;style size=\"24\"&gt;2&lt;/style&gt;\n&lt;style size=\"16\"&gt;1&lt;/style&gt;\n</pre>
For more information about the recommended text formatting solution, please take a look at the <a href="../markup/index.html" target="_blank" class="element">Markup Sample</a>.
<br>

<br>

<b>Running the Sample</b>

<br>

<br>
Running the sample requires the <a href="http://ant.apache.org/" target="_blank" class="element">Apache Ant</a> library. Make sure that <span class="code"><code>ant</code></span> is already installed on your system (version 1.5 or later).
<br>
In a command prompt/terminal window set the current folder to <span class="code"><code>demo/samples/styledtext</code></span> within the JasperReports source project and run the <span class="code"><code>&gt; ant test view</code></span> command.
<br>
It will generate all supported document types containing the sample report in the <span class="code"><code>demo/samples/styledtext/build/reports</code></span> directory. 
<br>
Then the report will open in the JasperReports internal viewer.
</span></td>
</tr>
<tr>
<td colspan="6">
<br>
</td>
</tr>
</table>
<br>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td>
<hr size="1">
</td>
</tr>
<tr>
<td align="center"><span class="copy">&copy; 2001-2010 Jaspersoft Corporation <a href="http://www.jaspersoft.com" target="_blank" class="copy">www.jaspersoft.com</a></span></td>
</tr>
</table>
</body>
</html>