Sophie

Sophie

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

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 - Batch Export 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 - Batch Export 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 multiple reports could be concatenated during export.</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/batchexport/?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="#batchexport">Exporting Multiple Reports into a Single Output File (Batch Export)</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="batchexport"></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">Exporting Multiple Reports into a Single Output File (Batch Export)</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">
Several reports can be exported together to form a single resulting document.
    </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">0.6.0</span></td>
</tr>
<tr>
<td colspan="6">
<br>
</td>
</tr>
<tr>
<td>
<br>
</td><td colspan="5"><span class="description">
<b>Exporter Input</b>

<br>

<br>
The input data for an exporter comes in the form of one or more JasperPrint 
documents that must be exported to some other document format. These JasperPrint 
objects may be already in memory, come from the network through an input stream, or 
reside in files on disk. 
<br>
An exporter should be able to handle such a wide range of document sources. In fact, all 
the exporter implementations that are shipped inside the library already do this. They all 
extend the <span class="code"><code>net.sf.jasperreports.engine.JRAbstractExporter</code></span> class, which 
holds all the logic for dealing with the source documents that need to be exported inside 
its defined <span class="code"><code>setInput()</code></span> method. 
<br>

<br>

<b>Batch Mode Export</b>

<br>

<br>
The first thing an exporter needs to know is whether it is acting on a single 
JasperPrint document or a list with several such generated documents. Exporting 
multiple JasperPrint objects to a single resulting document is called batch mode 
exporting.
<br>
Not all exporters can work in batch mode, but those that do first look into the supplied 
parameter values to see whether a <span class="code"><code>java.util.List</code></span> of JasperPrint object has been 
supplied to them using the <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRExporterParameter.html#JASPER_PRINT_LIST" target="_blank">JASPER_PRINT_LIST</a></span> exporter parameter. If so, the exporter 
loops through this list of documents and produces a single document from them.
<br> 
If the exporters act on a single document, then they check whether a value is supplied to 
the <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRExporterParameter.html#JASPER_PRINT" target="_blank">JASPER_PRINT</a></span> parameter, representing a single in-memory JasperPrint document 
that must be exported. If no value is found for this parameter, then the input for the 
exporter is a single JasperPrint document to be loaded from an input stream, an URL, 
a file object, or a file name. The exporter checks the following exporter parameters in 
this exact order, stopping at the first that has a non-null value: <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRExporterParameter.html#INPUT_STREAM" target="_blank">INPUT_STREAM</a></span>, 
<span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRExporterParameter.html#INPUT_URL" target="_blank">INPUT_URL</a></span>, <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRExporterParameter.html#INPUT_FILE" target="_blank">INPUT_FILE</a></span>, 
and <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRExporterParameter.html#INPUT_FILE_NAME" target="_blank">INPUT_FILE_NAME</a></span>. If it does not find any of these 
parameters being set, then the exporter throws an exception telling that no 
input source was set for the export process.
<br>

<br>

<b>Batch Mode Bookmarks</b>

<br>

<br>
When several JasperPrint documents must be concatenated in the same PDF file by 
batch export, you can introduce PDF bookmarks in the resulting PDF document to mark 
the beginning of each individual document that was part of the initial document list. 
<br>
These bookmarks have the same name as the original JasperPrint document as 
specified by the <span class="code"><code>jasperPrint.getName()</code></span> property. However, users can turn on and off 
the creation of those bookmarks by setting the <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/export/JRPdfExporterParameter.html#IS_CREATING_BATCH_MODE_BOOKMARKS" target="_blank">IS_CREATING_BATCH_MODE_BOOKMARKS</a></span> 
exporter parameter to Boolean.TRUE or Boolean.FALSE. The exporter does not create 
such bookmarks by default. 
<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/batchexport</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/batchexport/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>