我正在使用iReport 4.7.0
. 要获得表格格式的报告,我连接到SQL Server 2005
.
我在设计一个表时创建了一个数据集,该表为我提供了一个位于数据库表中的字段值,但是在完成设计后,当我预览我的jrxml
文件时,它没有向我显示一个带有值的表。
我想知道是什么问题。
我的jrxml
文件:
<?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="Test" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="09817b9b-055f-4d9f-b22e-85b7fac3d81e" whenNoDataType="AllSectionsNoDetail">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="35"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
<style backcolor="#EFF7FF"/>
</conditionalStyle>
</style>
<subDataset name="New Dataset 1" uuid="9bfe7683-aa43-4113-b4a6-8007d4c7ff5d">
<queryString language="SQL">
<![CDATA[select * from employee]]>
</queryString>
<field name="id" class="java.lang.Integer"/>
<field name="first_name" class="java.lang.String"/>
<field name="last_name" class="java.lang.String"/>
<field name="salary" class="java.lang.Integer"/>
<group name="id">
<groupExpression><![CDATA[$F{id}]]></groupExpression>
</group>
<group name="first_name">
<groupExpression><![CDATA[$F{first_name}]]></groupExpression>
</group>
<group name="last_name">
<groupExpression><![CDATA[$F{last_name}]]></groupExpression>
</group>
</subDataset>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement uuid="3f6a40c5-cb7c-4237-8635-19aab55cef63" x="205" y="16" width="100" height="20"/>
<textElement>
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[Test Database]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<detail>
<band height="125" splitType="Stretch">
<componentElement>
<reportElement uuid="6dc5bcfb-b281-4ec4-a611-4e5b602031ed" key="table" style="table" x="16" y="10" width="527" height="115"/>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="New Dataset 1" uuid="ba8de9b8-6e5b-4178-a62d-380ec6e268c2">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column uuid="8a09f431-ce9d-4c86-bde8-b6eba830a10f" width="90">
<jr:columnHeader style="table_CH" height="30" rowSpan="1">
<staticText>
<reportElement uuid="05cb64bd-b18c-4323-9365-ed6fa5d763ae" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[id]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter style="table_CH" height="31" rowSpan="1"/>
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement uuid="2fb15323-2f8b-4234-ae0b-7272676180df" x="0" y="0" width="90" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column uuid="db3eb7e3-b13d-4dff-b4cf-c64aa06853f2" width="90">
<jr:columnHeader style="table_CH" height="30" rowSpan="1">
<staticText>
<reportElement uuid="d60ed209-0e4f-4e66-8a4b-53a117a4fdf2" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[first_name]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter style="table_CH" height="31" rowSpan="1"/>
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement uuid="4dc05d21-5b86-4da2-b64f-9f83666e1948" x="0" y="0" width="90" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{first_name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column uuid="1bdd10f7-b718-4fbc-9fca-9f0a7883dc5c" width="90">
<jr:columnHeader style="table_CH" height="30" rowSpan="1">
<staticText>
<reportElement uuid="2bdbbd7d-f990-4261-9243-6b0f9f7feb7b" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[last_name]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter style="table_CH" height="31" rowSpan="1"/>
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement uuid="d361d452-b63c-47ff-a2de-33b3f6bebe9c" x="0" y="0" width="90" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{last_name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column uuid="da448dd2-72b0-4e70-92f8-0343fa894cc0" width="90">
<jr:columnHeader style="table_CH" height="30" rowSpan="1">
<staticText>
<reportElement uuid="388b140a-53d8-4097-b483-007767ab3494" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[salary]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter style="table_CH" height="31" rowSpan="1"/>
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement uuid="25c5ca88-39e2-4ea2-abd7-d1afe2df4ed9" x="0" y="0" width="90" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{salary}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch">
<line>
<reportElement uuid="e22bf754-66e2-4993-9e24-93ef1cfadaaa" x="0" y="44" width="555" height="1"/>
</line>
</band>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch">
<textField>
<reportElement uuid="94fcb4b3-e6da-4603-a6f1-f10063aee62e" x="409" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>