Hi,
I am using IReport 4 and Jasper Report 4 with Netbeans 6.8 in my application. I am able to successfully export the report to pdf form. But the exported report pdf doesn't have the look and feel of the report previwed in IReport designer. For example, the page number i,e, page 1 of 6 , doesn't show up in the exported pdf. Also, the lines that i am using after each row doesn't come up in the exported report.
I have attached both the files with this post. Also posting the XML source of the jasper report.:
<?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="report name" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString>
<![CDATA[SELECT
applicant.`name` AS applicant_name,
applicant.`age` AS applicant_age
FROM
`applicant` applicant]]>
</queryString>
<field name="applicant_name" class="java.lang.String"/>
<field name="applicant_age" class="java.lang.Integer"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="72" splitType="Stretch">
<staticText>
<reportElement mode="Opaque" x="220" y="31" width="179" height="21"/>
<textElement>
<font fontName="Times New Roman" size="18" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[ Test Report]]></text>
</staticText>
<line>
<reportElement x="173" y="57" width="226" height="1"/>
</line>
</band>
</title>
<pageHeader>
<band height="46" splitType="Stretch">
<textField>
<reportElement x="433" y="19" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.String"><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="513" y="19" width="40" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="24" splitType="Stretch">
<staticText>
<reportElement x="54" y="0" width="100" height="20"/>
<textElement>
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[Name]]></text>
</staticText>
<staticText>
<reportElement x="399" y="0" width="100" height="20"/>
<textElement>
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[Age]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="58" splitType="Stretch">
<textField>
<reportElement x="391" y="16" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{applicant_age}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="54" y="16" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{applicant_name}]]></textFieldExpression>
</textField>
<line>
<reportElement x="44" y="47" width="482" height="1"/>
</line>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch">
<staticText>
<reportElement x="220" y="19" width="149" height="20"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[INFORMATION SYSTEM]]></text>
</staticText>
</band>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
Any help will be appreciated.
I am using IReport 4 and Jasper Report 4 with Netbeans 6.8 in my application. I am able to successfully export the report to pdf form. But the exported report pdf doesn't have the look and feel of the report previwed in IReport designer. For example, the page number i,e, page 1 of 6 , doesn't show up in the exported pdf. Also, the lines that i am using after each row doesn't come up in the exported report.
I have attached both the files with this post. Also posting the XML source of the jasper report.:
<?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="report name" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString>
<![CDATA[SELECT
applicant.`name` AS applicant_name,
applicant.`age` AS applicant_age
FROM
`applicant` applicant]]>
</queryString>
<field name="applicant_name" class="java.lang.String"/>
<field name="applicant_age" class="java.lang.Integer"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="72" splitType="Stretch">
<staticText>
<reportElement mode="Opaque" x="220" y="31" width="179" height="21"/>
<textElement>
<font fontName="Times New Roman" size="18" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[ Test Report]]></text>
</staticText>
<line>
<reportElement x="173" y="57" width="226" height="1"/>
</line>
</band>
</title>
<pageHeader>
<band height="46" splitType="Stretch">
<textField>
<reportElement x="433" y="19" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.String"><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="513" y="19" width="40" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="24" splitType="Stretch">
<staticText>
<reportElement x="54" y="0" width="100" height="20"/>
<textElement>
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[Name]]></text>
</staticText>
<staticText>
<reportElement x="399" y="0" width="100" height="20"/>
<textElement>
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[Age]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="58" splitType="Stretch">
<textField>
<reportElement x="391" y="16" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{applicant_age}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="54" y="16" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{applicant_name}]]></textFieldExpression>
</textField>
<line>
<reportElement x="44" y="47" width="482" height="1"/>
</line>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch">
<staticText>
<reportElement x="220" y="19" width="149" height="20"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[INFORMATION SYSTEM]]></text>
</staticText>
</band>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
Any help will be appreciated.