Dynamic Jasper: Image not displayed after exporting as XLSX
<p>I'm using <code>JRXlsxExporter</code>to export my JasperReport to XLSX format. To create the output stream, I'm opening up a blob stream and setting it to the <code>SimpleOutputStreamExporterOutput</code>. The blob is then saved to the DB after the <code>exporter.exportReport()</code> method is called.</p>

<pre><code>OutputStreamExporterOutput simpleOutputStreamExporterOutput = new SimpleOutputStreamExporterOutput(blob.setBinaryStream(1));
</code></pre>

<p>The problem is, there is a jpg image part of the report content. When the report is exported to XLSX, 'The image cannot be displayed' message shows up in the xlsx in place of the image, but the rest of the data comes up fine.</p>

<p>I tried using a <code>FileOutputStream</code> instead of the blob stream and everything including the image comes up fine in the exported xlsx. But since I cannot be saving the exported report files on the application servers, and since I have to write to the DB as a blob, I would most definitely want to use the blob stream.</p>

<ul>
<li>Jasper reports version - 6.2.0</li>
<li>Dynamic Jasper version - 5.0.4</li>
</ul>

<p>I'm using the DynamicReportBuilder <code>addFirstPageImageBanner()</code> method to add the image.</p>

<p>Any help is deeply appreciated. Thank you!</p>

<p>Here's part of my jrxml file as requested.</p>

<pre><code>&lt;title&gt;
        &lt;band height="30"/&gt;
    &lt;/title&gt;
    &lt;pageHeader&gt;
        &lt;band height="141"&gt;
            &lt;textField&gt;
                &lt;reportElement x="0" y="78" width="290" height="78"/&gt;
                &lt;textElement&gt;
                    &lt;font fontName="Times New Roman"/&gt;
                &lt;/textElement&gt;
                &lt;textFieldExpression class="java.lang.String"&gt;&lt;![CDATA[$P{reportInfo}]]&gt;&lt;/textFieldExpression&gt;
            &lt;/textField&gt;
            &lt;textField&gt;
                &lt;reportElement x="0" y="58" width="290" height="20"/&gt;
                &lt;textElement&gt;
                    &lt;font fontName="Times New Roman" size="14" isBold="true"/&gt;
                &lt;/textElement&gt;
                &lt;textFieldExpression class="java.lang.String"&gt;&lt;![CDATA[$P{reportType}]]&gt;&lt;/textFieldExpression&gt;
            &lt;/textField&gt;
            &lt;textField&gt;
                &lt;reportElement x="0" y="38" width="290" height="20"/&gt;
                &lt;textElement&gt;
                    &lt;font fontName="Times New Roman" size="14" isBold="true"/&gt;
                &lt;/textElement&gt;
                &lt;textFieldExpression class="java.lang.String"&gt;&lt;![CDATA[$P{reportTitle}]]&gt;&lt;/textFieldExpression&gt;
            &lt;/textField&gt;
            &lt;textField&gt;
                &lt;reportElement x="0" y="0" width="290" height="38"/&gt;
                &lt;textElement&gt;
                    &lt;font fontName="Times New Roman" size="18" isBold="true"/&gt;
                &lt;/textElement&gt;
                &lt;textFieldExpression class="java.lang.String"&gt;&lt;![CDATA[$P{title}]]&gt;&lt;/textFieldExpression&gt;
            &lt;/textField&gt;
        &lt;/band&gt;
    &lt;/pageHeader&gt;
</code></pre>

<p>Here's the code to add the image though:</p>

<pre><code>drb.addFirstPageImageBanner("imagepath" + "imagename", new Integer(197), new Integer(53), ImageBanner.ALIGN_LEFT);
</code></pre>