spring-mvcjasper-reportsjasper-plugin

Jasper Report HTML preview showing unwanted data ( images )


I am working on Jasper Report with Spring MVC - I referred this example. Every thing is working fine except HTML and CSV.

This is my Template code:

 <?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report7" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e781fb26-bdb1-4341-b785-875a90e92412">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <parameter name="titlenumber" class="java.lang.String"/>
    <parameter name="title" class="java.lang.String"/>
    <parameter name="author" class="java.lang.String"/>
    <parameter name="edition" class="java.lang.String"/>
    <parameter name="publisher" class="java.lang.String"/>
    <parameter name="publishedyear" class="java.lang.String"/>
    <parameter name="noofcopies" class="java.lang.Long"/>
    <parameter name="organisationname" class="java.lang.String"/>
    <parameter name="gropwisereportname" class="java.lang.String"/>
    <parameter name="slno" class="java.lang.Long"/>
    <parameter name="noofdistincttitle" class="java.lang.Long"/>
    <parameter name="copies" class="java.lang.Long"/>
    <parameter name="totalnoofdistincttitle" class="java.lang.Long"/>
    <parameter name="totalnoofcopies" class="java.lang.Long"/>
    <field name="title" class="java.lang.String"/>
    <field name="author" class="java.lang.String"/>
    <field name="edition" class="java.lang.String"/>
    <field name="publisher" class="java.lang.String"/>
    <field name="publishedyear" class="java.lang.String"/>
    <field name="noofcopies" class="java.lang.Long"/>
    <field name="organisationname" class="java.lang.String"/>
    <field name="groupwisereportname" class="java.lang.String"/>
    <field name="titlenumber" class="java.lang.String"/>
    <field name="slno" class="java.lang.Long"/>
    <field name="noofdistincttitle" class="java.lang.Long"/>
    <field name="copies" class="java.lang.Long"/>
    <field name="totalnoofdistincttitle" class="java.lang.Long"/>
    <field name="totalnoofcopies" class="java.lang.Long"/>
    <group name="Department">
        <groupExpression><![CDATA[$F{groupwisereportname}]]></groupExpression>
        <groupHeader>
            <band height="51">
                <staticText>
                    <reportElement uuid="85e3c1cd-d52f-4711-9598-69991f424d6d" x="1" y="17" width="108" height="20"/>
                    <textElement>
                        <font size="12" isBold="true"/>
                    </textElement>
                    <text><![CDATA[Department : ]]></text>
                </staticText>
                <staticText>
                    <reportElement uuid="f6144a0a-28a4-4167-9ccb-8d06a98b1061" x="119" y="17" width="445" height="20"/>
                    <textElement markup="none">
                        <font size="12" isBold="true"/>
                    </textElement>
                    <text><![CDATA[$F{groupwisereportname}]]></text>
                </staticText>
            </band>
        </groupHeader>
        <groupFooter>
            <band height="34">
                <staticText>
                    <reportElement uuid="b07c4e8a-cdc8-40c5-b24c-4a784178283a" x="438" y="8" width="103" height="20"/>
                    <textElement markup="none"/>
                    <text><![CDATA[$F{noofcopies}]]></text>
                </staticText>
                <line>
                    <reportElement uuid="3256c6db-ee6f-42e6-ba36-64e039dac413" x="1" y="0" width="555" height="1"/>
                </line>
                <line>
                    <reportElement uuid="787435f7-1985-4f2d-95d8-1606107f423b" x="1" y="27" width="555" height="1"/>
                </line>
                <staticText>
                    <reportElement uuid="3392c742-48bf-4af9-9a9d-563b5bf4db84" x="1" y="7" width="165" height="20"/>
                    <textElement>
                        <font size="12" isBold="true"/>
                    </textElement>
                    <text><![CDATA[Number Of Distinct Title : ]]></text>
                </staticText>
                <staticText>
                    <reportElement uuid="1111dd28-8037-426c-a421-0d2a2913ebfe" x="327" y="7" width="104" height="20"/>
                    <textElement>
                        <font size="12" isBold="true"/>
                    </textElement>
                    <text><![CDATA[No Of Copies :]]></text>
                </staticText>
                <staticText>
                    <reportElement uuid="1ff4e899-b6be-44f6-86eb-b3426da1d04a" x="172" y="8" width="104" height="20"/>
                    <textElement markup="none"/>
                    <text><![CDATA[$F{noofdistincttitle}]]></text>
                </staticText>
            </band>
        </groupFooter>
    </group>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="22" splitType="Stretch">
            <staticText>
                <reportElement uuid="2b29cfa5-162a-44f7-b97a-9c96867bef0f" mode="Opaque" x="-1" y="0" width="555" height="20" forecolor="#333333" backcolor="#FFFFFF"/>
                <textElement textAlignment="Center" markup="none">
                    <font size="14" isBold="true"/>
                </textElement>
                <text><![CDATA[$F{organisationname}]]></text>
            </staticText>
        </band>
    </title>
    <columnHeader>
        <band height="17" splitType="Stretch">
            <frame>
                <reportElement uuid="6af6ec1d-6a7d-4421-b5f7-4e69fb52e90a" mode="Opaque" x="0" y="1" width="555" height="16" forecolor="#000000" backcolor="#33CCFF"/>
            </frame>
            <staticText>
                <reportElement uuid="91a75deb-ed83-4f44-8efc-acc5e971f7b5" x="36" y="1" width="60" height="16"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Title No]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="bae56609-14a3-4919-bb0d-edc85acb9ac9" x="98" y="1" width="135" height="16"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Title]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="623aaa5f-2d39-4f31-bdd5-09adb6dd9ee4" x="235" y="1" width="90" height="16"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Authors]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="1018336a-d7fa-43dc-aad0-c89214f680ce" x="328" y="1" width="31" height="16"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Edn]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="23a0c55c-1daa-4601-b726-23688d229341" x="361" y="1" width="87" height="16"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Publisher]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="4bb0fbec-07e7-4e08-a55e-76a445bc29a5" x="450" y="1" width="47" height="16"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Year]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="588d37b3-1e19-4644-bfb5-74f3c71db65e" x="499" y="1" width="55" height="16"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Copies]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="9f6289db-d4a3-4d60-9cc2-ed56cb6e2be1" x="-1" y="1" width="35" height="16"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[SlNo]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="22" splitType="Stretch">
            <staticText>
                <reportElement uuid="4de128bc-8717-42e6-af2e-7e2a9e311807" x="35" y="1" width="60" height="20"/>
                <textElement markup="none"/>
                <text><![CDATA[$F{titlenumber}]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="faf07beb-d19e-44a3-b3a7-2fd7d6b83f44" x="97" y="1" width="135" height="20"/>
                <textElement markup="none"/>
                <text><![CDATA[$F{title}]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="7aefa31d-a4a2-404d-a072-6c6cfc3136e2" x="234" y="1" width="90" height="20"/>
                <textElement markup="none"/>
                <text><![CDATA[$F{author}]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="84e5116f-db2e-46d2-bc04-8874c1810b65" x="326" y="1" width="31" height="20"/>
                <textElement markup="none"/>
                <text><![CDATA[$F{edition}]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="a9960c07-397e-46d6-8e43-3411ceeb9371" x="359" y="1" width="87" height="20"/>
                <textElement markup="none"/>
                <text><![CDATA[$F{publisher}]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="f5da8326-733b-4ae3-8f52-ef689fe2f76b" x="389" y="1" width="48" height="20"/>
                <textElement markup="none"/>
                <text><![CDATA[$F{publishedyear}]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="e464649d-6afc-4ad5-aad0-b8f8562951f1" x="498" y="1" width="58" height="20"/>
                <textElement markup="none"/>
                <text><![CDATA[$F{copies}]]></text>
            </staticText>
            <line>
                <reportElement uuid="45d573ee-f741-4a09-be39-749e2c2c7da8" x="1" y="21" width="555" height="1" forecolor="#CCCCCC"/>
            </line>
            <staticText>
                <reportElement uuid="eecddf5a-1f22-4cb7-89c5-9a94e9de366b" x="-2" y="1" width="35" height="20"/>
                <textElement markup="none"/>
                <text><![CDATA[$F{slno}]]></text>
            </staticText>
        </band>
    </detail>
    <summary>
        <band height="47" splitType="Stretch">
            <line>
                <reportElement uuid="365a7e6d-52e2-4ab4-9787-06455b19e980" x="0" y="25" width="555" height="1"/>
            </line>
            <staticText>
                <reportElement uuid="233e4ff7-3a3b-46d9-ad07-9b24b2990af0" x="313" y="26" width="126" height="20"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Total No Of Copies :]]></text>
            </staticText>
            <line>
                <reportElement uuid="61066175-bd0b-4e30-8abe-4e64c2083e32" x="1" y="46" width="555" height="1"/>
            </line>
            <staticText>
                <reportElement uuid="b3629b63-77a0-40cb-9c6c-780a26894808" x="163" y="27" width="122" height="20"/>
                <textElement markup="none"/>
                <text><![CDATA[$F{totalnoofdistincttitle}]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="dd38b5d3-5b1d-43b6-b89e-2e02405104cb" x="439" y="27" width="103" height="20"/>
                <textElement markup="none"/>
                <text><![CDATA[$F{totalnoofcopies}]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="ac0976b4-c696-4cf7-a465-da04a5a3046a" x="1" y="26" width="153" height="20"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Total No OF Distinct Title : ]]></text>
            </staticText>
        </band>
    </summary>
</jasperReport>

How it looks:

enter image description here

If I see the preview in PDF it will come as expected:

enter image description here

But if I see in HTML, it add some image tags itself:

enter image description here

Like this enter image description here

I do not understand what mistake I have made.

CSV preview looks like this:

,,,,,,,Wings OF FireWings ,,,,,,,,, Title,,,,Subtitle,,,,PublishedYear,,,No,,,Accesn,, ,Wings OF FireWings ,,,,,,,,,,,,,,, ,,Wings OF FireWings ,,,,V0001,,,2013,,,,Wings OF FireWings ,,,Wings OF FireWings ,,Wings OF FireWings ,,,,V0001,,,2013,,,,Wings OF FireWings ,,,Wings OF FireWings ,,Wings OF FireWings ,,,,V0001,,,2013,,,,Wings OF FireWings ,,,Wings OF FireWings ,,Wings OF FireWings ,,,,V0001,,,2013,,,,Wings OF FireWings ,,,Wings OF FireWings ,,Wings OF FireWings ,,,,V0001,,,2013,,,,Wings OF FireWings ,,,Wings OF FireWings Wings OF FireWings ,,,,,,,,,,,,,,,, ,,,Wings OF FireWings ,,Wings OF FireWings ,,,,,Wings OF FireWings ,,Wings OF FireWings ,,,Wings OF FireWings ,

Any help would be appreciated, and thanks.


Solution

  • Add property to avoid using images to align.

    <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" ...>
      <property name="net.sf.jasperreports.export.html.using.images.to.align" value="false"/>
    

    Default value is true
    HTH