Jump to content
Changes to the Jaspersoft community edition download ×

Dynamic Jasper: Image not displayed after exporting as XLSX


amithleeladamodaran

Recommended Posts

I'm using JRXlsxExporter to export my JasperReport to XLSX format. To create the output stream, I'm opening up a blob stream and setting it to the SimpleOutputStreamExporterOutput. The blob is then saved to the DB after the exporter.exportReport() method is called.

OutputStreamExporterOutput simpleOutputStreamExporterOutput = new SimpleOutputStreamExporterOutput(blob.setBinaryStream(1));[/code]

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.

I tried using a FileOutputStream 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. 

  • Jasper reports version - 6.2.0
  • Dynamic Jasper version - 5.0.4

I'm using the DynamicReportBuilder addFirstPageImageBanner() method to add the image. Here's the code to add the image:

drb.addFirstPageImageBanner("imagepath" + "imagename", new Integer(197), new Integer(53), ImageBanner.ALIGN_LEFT);[/code]

Here's part of my jrxml file as well. But I'm not using the image tag in the jrxml to add the image though, it is being done with the above method.

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

Is this a known bug with the 6.x release, with the Blob output stream? Coz it used to work for us fine with the 3.x release.

Any help is deeply appreciated. Thank you!

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...