I need a report in my web application.For that i have designed a jrxml in iReport. I had made a blank A4 template. And i had complied that file and then put that jrxml file to my classpath. But when i select that html view, an 'X' image is diplaying in that page. In view source, that element is given as
<td><img alt="" src="nullpx" style="width: 46px; height: 1px;"/></td>
My jsxml file is like
<?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="myreport" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="a086f896-d28c-413e-8acc-416ff16d190a">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<field name="clientName" class="java.lang.String"/>
<field name="currentBalance" class="java.lang.Float"/>
<field name="creditLimit" class="java.lang.Float"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="33" splitType="Stretch">
<staticText>
<reportElement uuid="bc001d2d-32f7-4222-8155-79f0ebd97aa3" x="26" y="2" width="100" height="20"/>
<textElement/>
<text><![CDATA[clientName]]></text>
</staticText>
<staticText>
<reportElement uuid="15f41fea-5cad-43b4-809b-7285fb9fea9f" x="201" y="2" width="100" height="20"/>
<textElement/>
<text><![CDATA[currentBalance]]></text>
</staticText>
<staticText>
<reportElement uuid="16d187cb-beb0-4799-bdcf-5bfdb1583626" x="416" y="2" width="100" height="20"/>
<textElement/>
<text><![CDATA[creditLimit]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="38" splitType="Stretch">
<textField>
<reportElement uuid="2cf8baa2-d1bc-46e2-a194-422d8d967f38" x="26" y="10" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{clientName}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="6c560e8a-8020-453c-9f5c-84cf9a964391" x="201" y="10" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{currentBalance}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="d8d431d9-8be9-46fb-bb43-3f4583c9c9e2" x="416" y="10" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{creditLimit}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
Is there anyway that i can use html with out any images in htmlpage..
Set JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN property to 'false'
Set the exporterParameter named net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN to false:
For example:
<bean id="multiViewReport" class="org.springframework.web.servlet.view.jasperreports.JasperReportsMultiFormatView">
<property name="url" value="classpath:someJasperReport.jrxml" />
<!-- Set the ModelMap attribute "reportDataKey" to the JRDataSourceProvider -->
<property name="reportDataKey" value="reportDSProvider" />
<property name="exporterParameters">
<map>
<entry
key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN">
<value>false</value>
</entry>
</map>
</property>
</bean>
and my controller method looks like this:
@RequestMapping(value = "/report/{format}", method = RequestMethod.GET)
public String printWelcome(ModelMap model, @PathVariable(value = "format") String format) {
JRDataSourceProvider jrDataSourceProvider = .....;
model.addAttribute("format", format);
model.addAttribute("reportDSProvider", jrDataSourceProvider);
return "multiViewReport";
}
This controller allows me to produce different report formats by just appending the format type to the base url.
For example: http://yourhost.com:8080/springmvc-jasperreports/report/pdf
PS: I tested this with spring-webmvc 3.2.1.RELEASE and jasperreports 4.5.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With