我的Jasper报表运行查询并获得数据。数据显示在表组件中并导出到excel文件中。
我的问题是,包含数据的表组件被打印多次(大约20次)。我不知道为什么会这样。
我对Jasper Reports比较陌生(我已经学了一个星期了),所以我很可能会遗漏一些东西。
以下是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="projectbycustomerreport" pageWidth="752" pageHeight="572" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="752" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="476a09b7-7823-4320-aaa0-3721aee471cc">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="94"/>
<subDataset name="TableDataset" uuid="09d8857b-956c-490e-b34d-72860983bdf9">
<parameter name="DATE_FROM" class="java.lang.String" isForPrompting="false"/>
<parameter name="DATE_TO" class="java.lang.String" isForPrompting="false"/>
<parameter name="MAIN_CUST_NUM" class="java.lang.String" isForPrompting="false"/>
<parameter name="MAIN_PROJ_NUM" class="java.lang.Integer" isForPrompting="false"/>
<queryString>
<![CDATA[SELECT TSDATE, TSCONO, TSCSNO, TSDEPT, TSPRNO, TSPHAS, TSMSNO, TSTASK, ITEM, TSSRNO, TSPSAN, TSWONO, TSSIRN, TSTSKH, TSBILH, TSNBHC, TSNBHI, TSTRFH, TSOTHH, TSTRVT, TSMILE, TSCCNM FROM WeeklyTimesheetTable WHERE((TSDATE BETWEEN CONVERT(date,$P{DATE_FROM}) AND CONVERT(date,$P{DATE_TO})) AND (TSCSNO=$P{MAIN_CUST_NUM}) AND (TSPRNO=$P{MAIN_PROJ_NUM}))]]>
</queryString>
<field name="TSDATE" class="java.lang.String"/>
<field name="TSCONO" class="java.lang.Integer"/>
<field name="TSCSNO" class="java.lang.String"/>
<field name="TSDEPT" class="java.lang.String"/>
<field name="TSPRNO" class="java.lang.Integer"/>
<field name="TSPHAS" class="java.lang.Integer"/>
<field name="TSMSNO" class="java.lang.Double"/>
<field name="TSTASK" class="java.lang.Double"/>
<field name="ITEM" class="java.lang.String"/>
<field name="TSSRNO" class="java.lang.String"/>
<field name="TSPSAN" class="java.lang.String"/>
<field name="TSWONO" class="java.lang.String"/>
<field name="TSSIRN" class="java.lang.String"/>
<field name="TSTSKH" class="java.lang.Double"/>
<field name="TSBILH" class="java.lang.Double"/>
<field name="TSNBHC" class="java.lang.Double"/>
<field name="TSNBHI" class="java.lang.Double"/>
<field name="TSTRFH" class="java.lang.Double"/>
<field name="TSOTHH" class="java.lang.Double"/>
<field name="TSTRVT" class="java.lang.Double"/>
<field name="TSMILE" class="java.lang.Double"/>
<field name="TSCCNM" class="java.lang.String"/>
<sortField name="TSCONO"/>
<sortField name="TSDATE"/>
</subDataset>
<parameter name="CUST_ID" class="java.lang.String" isForPrompting="false"/>
<parameter name="PROJ_ID" class="java.lang.String" isForPrompting="false"/>
<parameter name="DATE_FROM" class="java.lang.String" isForPrompting="false"/>
<parameter name="DATE_TO" class="java.lang.String" isForPrompting="false"/>
<parameter name="DATE_GEN" class="java.lang.String" isForPrompting="false"/>
<parameter name="TIME_GEN" class="java.lang.String" isForPrompting="false"/>
<parameter name="MAIN_PROJ_NUM" class="java.lang.Integer" isForPrompting="false"/>
<parameter name="MAIN_CUST_NUM" class="java.lang.String" isForPrompting="false"/>
<queryString>
<![CDATA[SELECT TSDATE, TSCONO, TSCSNO, TSDEPT, TSPRNO, TSPHAS, TSMSNO, TSTASK, ITEM, TSSRNO, TSPSAN, TSWONO, TSSIRN, TSTSKH, TSBILH, TSNBHC, TSNBHI, TSTRFH, TSOTHH, TSTRVT, TSMILE, TSCCNM FROM WeeklyTimesheetTable WHERE((TSDATE BETWEEN CONVERT(date,$P{DATE_FROM}) AND CONVERT(date,$P{DATE_TO})) AND (TSCSNO=$P{MAIN_CUST_NUM}) AND (TSPRNO=$P{MAIN_PROJ_NUM}))]]>
</queryString>
<field name="TSDATE" class="java.lang.String"/>
<field name="TSCONO" class="java.lang.Integer"/>
<field name="TSCSNO" class="java.lang.String"/>
<field name="TSDEPT" class="java.lang.String"/>
<field name="TSPRNO" class="java.lang.Integer"/>
<field name="TSPHAS" class="java.lang.Integer"/>
<field name="TSMSNO" class="java.lang.Double"/>
<field name="TSTASK" class="java.lang.Double"/>
<field name="ITEM" class="java.lang.String"/>
<field name="TSSRNO" class="java.lang.String"/>
<field name="TSPSAN" class="java.lang.String"/>
<field name="TSWONO" class="java.lang.String"/>
<field name="TSSIRN" class="java.lang.String"/>
<field name="TSTSKH" class="java.lang.Double"/>
<field name="TSBILH" class="java.lang.Double"/>
<field name="TSNBHC" class="java.lang.Double"/>
<field name="TSNBHI" class="java.lang.Double"/>
<field name="TSTRFH" class="java.lang.Double"/>
<field name="TSOTHH" class="java.lang.Double"/>
<field name="TSTRVT" class="java.lang.Double"/>
<field name="TSMILE" class="java.lang.Double"/>
<field name="TSCCNM" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="191" splitType="Stretch">
<frame>
<reportElement uuid="a64247fb-c0f0-4ed8-9d4b-d086199fdee5" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="4" width="752" height="32" forecolor="#000000" backcolor="#3399FF"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid"/>
<leftPen lineWidth="1.0" lineStyle="Solid"/>
<bottomPen lineWidth="1.0" lineStyle="Solid"/>
<rightPen lineWidth="1.0" lineStyle="Solid"/>
</box>
<staticText>
<reportElement uuid="70fc51ae-580a-4a3d-961e-db5a2f8f6991" mode="Transparent" x="0" y="0" width="752" height="32" forecolor="#000000"/>
<textElement textAlignment="Center">
<font fontName="Arial" size="24" isBold="true"/>
</textElement>
<text><![CDATA[Project By Customer Report]]></text>
</staticText>
</frame>
<frame>
<reportElement uuid="79506db1-e406-4f92-9014-775900b6bba8" mode="Opaque" x="0" y="36" width="752" height="140" backcolor="#CCCCCC"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid"/>
<leftPen lineWidth="1.0" lineStyle="Solid"/>
<bottomPen lineWidth="1.0" lineStyle="Solid"/>
<rightPen lineWidth="1.0" lineStyle="Solid"/>
</box>
<staticText>
<reportElement uuid="6e97c9f7-360a-4476-bdc0-2f68f2c4aa17" x="0" y="5" width="150" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Customer ID & Name:]]></text>
</staticText>
<staticText>
<reportElement uuid="43f905dc-3c9d-42f3-96fd-089b46678c8d" x="0" y="32" width="150" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Project ID & Name:]]></text>
</staticText>
<staticText>
<reportElement uuid="0f6002cb-b314-44c3-8d3b-979512fd0bac" x="0" y="60" width="150" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Period:]]></text>
</staticText>
<staticText>
<reportElement uuid="5699709c-40df-44d4-9c27-df1f48de225b" x="0" y="88" width="150" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Date Generated:]]></text>
</staticText>
<staticText>
<reportElement uuid="c53d2360-f096-41b2-990e-27beb8608b4b" x="0" y="116" width="150" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Time Generated:]]></text>
</staticText>
<textField>
<reportElement uuid="02cf4c1b-53e4-46e9-80bd-9513012ad35e" x="150" y="5" width="602" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{CUST_ID}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="ad104c49-6300-4897-b2bc-7147bdab5bca" x="150" y="32" width="602" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{PROJ_ID}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="c56252dc-3713-4d49-99a8-df6a3ea056a0" x="150" y="88" width="100" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{DATE_GEN}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="cdf7af05-739a-4086-8d38-9fb3e0f45b35" x="150" y="116" width="226" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{TIME_GEN}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="94b1054e-ff88-4b6b-ac53-5e9caa4ed0a3" x="150" y="60" width="100" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{DATE_FROM}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="238f5e67-19f3-40c4-a9c2-b2ec1bbcbd32" x="250" y="60" width="26" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[to]]></text>
</staticText>
<textField>
<reportElement uuid="c119a6d7-b873-4d2e-bdbf-4482454b67d6" x="276" y="60" width="100" height="20"/>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{DATE_TO}]]></textFieldExpression>
</textField>
</frame>
</band>
</title>
<detail>
<band height="572" splitType="Stretch">
<componentElement>
<reportElement uuid="0f51d841-bb5b-4775-9b87-03ba695a6971" key="table 2" style="mainTable" x="0" y="0" width="752" height="572"/>
<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" whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="TableDataset" uuid="7d17fcfc-0541-4e5e-9a72-86649e38cd06">
<datasetParameter name="DATE_FROM">
<datasetParameterExpression><![CDATA[$P{DATE_FROM}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="DATE_TO">
<datasetParameterExpression><![CDATA[$P{DATE_TO}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="MAIN_CUST_NUM">
<datasetParameterExpression><![CDATA[$P{MAIN_CUST_NUM}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="MAIN_PROJ_NUM">
<datasetParameterExpression><![CDATA[$P{MAIN_PROJ_NUM}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="90" uuid="d375f5a3-db9e-450d-8ac2-e1a9a6fc18fc">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="4cd206f2-6591-41a5-969c-9466034aac24" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSDATE]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="47c0d3dd-aac2-44ff-a3e5-426cd092fd54" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSDATE}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="587ce56a-9008-43be-b850-dc5397b81c3a">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="73460bc8-c487-4712-8a50-99f624a6bab5" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSCONO]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="ce6aaaad-562e-4e8f-9841-d51759e57035" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSCONO}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="83d4280b-05a0-425e-a49c-f7eccc1880bf">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="834e3ec6-bdb8-46f5-99e5-9953a615f382" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSCSNO]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="584eadf1-ab41-44b6-9453-1c2fe27f329c" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSCSNO}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="076aa9f0-5519-4c17-a0d0-43263458e17f">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="2cbbc5b0-a585-4ee2-8f48-a7c336ca090e" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSDEPT]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="fdf84ff5-50b9-4ec8-b849-0bf4de80a7a7" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSDEPT}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="bc1af644-0380-4abe-bc32-8e130d24ffdf">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="3c0ebe11-a46a-421c-b312-99022544ca2a" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSPRNO]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="6e028901-0e32-4467-9387-79eefb3d54fc" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSPRNO}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="6ba32984-eeba-4b3c-815d-1c041a04bb08">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="7d6f0145-27c8-4f23-9e05-8a2c3714dfc7" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSPHAS]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="757f479d-f624-403f-94b2-a1a7f5deff21" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSPHAS}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="91e6bf63-edaf-4795-8e86-74a1b0c36e82">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="9687b2b4-4c0d-4771-96e5-906481ec8bae" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSMSNO]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="1efbda7d-3eb4-4f9e-9e01-04932ce2c518" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSMSNO}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="a5280cec-20f6-4f6b-978e-e6b9c8791e9a">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="3d4e6cac-734d-4944-9723-f5ecdd9cff8e" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSTASK]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="10c3896f-7c7a-443f-ae9a-fb6834d930a6" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSTASK}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="2780dc1e-fec7-4366-b97d-2bed6556b8ab">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="955b38e6-caf2-4952-9601-97fd88f61a9d" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[ITEM]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="e97694ca-dae7-40df-9b53-8aeeb138e546" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{ITEM}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="02111dc5-db46-4f99-a7c6-b26723cc1847">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="2615591e-7a96-47cf-9ca0-be9a563bf1b4" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSSRNO]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="694bcb7f-f283-4b62-a6ff-649fe4ab72c2" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSSRNO}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="52fc695f-50db-4bea-aef7-ad2cd7c9f108">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="eacf6552-ac9e-4450-9f15-7a237c6cfec8" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSPSAN]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="3a61da59-d709-4776-b805-e3b261f76786" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSPSAN}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="af9ce744-f683-4a3e-a75a-0ce9e58ab288">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="09e9bafe-84b1-4837-9fff-e028570c2aba" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSWONO]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="6cde712a-24db-4099-b602-7f05b87f38ad" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSWONO}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="a2c49ac5-3f2a-4bd3-a4d8-30efd4163beb">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="5d992a75-c66e-49ce-9f2a-09769ac751c1" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSSIRN]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="2dd04d7f-6477-45f7-b013-568d3ad0db26" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSSIRN}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="3484cb89-dd95-49eb-8c85-afc7567ed5bc">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="7bdbb4e4-8fb8-4706-9fc2-5f5b85aac79e" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSTSKH]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="09ec98f7-b2e4-438a-9a8d-7dd51db70cba" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSTSKH}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="ad93e1c3-e4ac-4367-a31e-440eddf776cd">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="3446f9bd-a05b-4574-a9a8-0f59ebdfed4e" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSBILH]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="cbcab416-75b2-4706-bfb1-d34ff6323b18" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSBILH}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="1b4fdc9d-5c59-4443-a7c8-6e5edd51ad75">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="d57feffc-245b-4bc7-85e4-38e8396c837e" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSNBHC]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="89731118-1073-48e3-a321-76a316c28b55" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSNBHC}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="93186b6f-adb3-4861-a503-4e782bf837b2">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="bbefa769-4e52-4f96-bb54-c4d019651d8b" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSNBHI]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="a257d745-f999-4826-b210-b60b7a871343" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSNBHI}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="89f3dea3-c95e-4099-bf3c-b1998a04b08c">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="4c405fd9-1210-40fd-9ca4-c298f81d842b" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSTRFH]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="bf152421-b30e-46c0-aec5-59330e8c39d6" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSTRFH}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="f1584ffe-d3a0-4716-9fd8-8304fb4e612d">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="ee774f5c-e8b1-4c41-8df3-912b68f88970" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSOTHH]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="5324f7a9-8001-4537-b239-a3763aeda84e" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSOTHH}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="e66738ed-9531-446b-a628-412161414eda">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="37b96194-8dde-4a13-a2c9-1ed2a78c8f51" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSTRVT]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="a4b7814a-ae7b-4b7b-adca-eac9bbe9abec" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSTRVT}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="58ce548b-0fc0-4ca7-901f-4aa76fd24a6e">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="9e7d4717-6a96-44cc-940a-7821b306713a" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSMILE]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="e4124f5e-8538-4243-8a35-204e515d02e9" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSMILE}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="7e7203e2-0707-4c7a-9e8e-f3a568387a20">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="082ae041-bbd5-42c3-bedd-2efd715bbe54" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSCCNM]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="a4e5d07e-c19c-4760-a0fd-415830172292" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSCCNM}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
</jasperReport>
public class JasperReporter {
private Connection sqlConnection;
private JasperReport report;
private JasperPrint printer;
private JRXlsExporter exporter;
public JasperReporter() {
com.microsoft.sqlserver.jdbc.SQLServerDataSource ds = new com.microsoft.sqlserver.jdbc.SQLServerDataSource();
ds.setDatabaseName("TimesheetControlSystem");
ds.setServerName("192.168.0.88");
ds.setPortNumber(1433);
ds.setPassword("*****");
ds.setUser("tester");
try {
if ((this.sqlConnection = ds.getConnection()) == null) {
javax.swing.JOptionPane.showMessageDialog(null, "Login Failed.", "Connection Status", javax.swing.JOptionPane.ERROR_MESSAGE);
}
} catch (SQLServerException ex) {
Logger.getLogger(JasperReporter.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void createReport() {
try {
this.report = JasperCompileManager.compileReport("F:\\Local Documents\\Programming Projects\\Java\\Testing Projects\\JasperReporter\\projectbycustomerreport.jrxml");
HashMap param = new HashMap();
param.put("PROJ_ID", "9000: Internal");
param.put("CUST_ID", "9055097252: Test");
param.put("DATE_FROM", "2013-01-01");
param.put("DATE_TO", "2013-01-28");
param.put("DATE_GEN", "2013-01-30");
param.put("TIME_GEN", "1:28 PM");
param.put("MAIN_CUST_NUM", "1036066254");
param.put("MAIN_PROJ_NUM", new Integer(9000));
this.printer = JasperFillManager.fillReport(report, param, this.sqlConnection);
this.exporter = new JRXlsExporter();
this.exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT, this.printer);
this.exporter.setParameter(JRXlsExporterParameter.OUTPUT_FILE, new File("F:\\Local Documents\\Programming Projects\\Java\\Testing Projects\\JasperReporter\\jasperxls.xls"));
this.exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);
this.exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
this.exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
this.exporter.exportReport();
} catch (JRException ex) {
Logger.getLogger(JasperReporter.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static void main(String[] args) {
jasperreporter.JasperReporter jr = new jasperreporter.JasperReporter();
jr.createReport();
}
}
您在详细信息带中添加了table组件,由此也有一个主报表查询。当主报表查询的结果集中有行时,会呈现详细信息带。在报表的摘要带中移动表,那么它将只呈现一次。
<summary>
<band height="138">
<componentElement>
<reportElement uuid="0f51d841-bb5b-4775-9b87-03ba695a6971" key="table 2" x="0" y="0" width="752" height="138"/>
<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" whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="TableDataset" uuid="7d17fcfc-0541-4e5e-9a72-86649e38cd06">
<datasetParameter name="DATE_FROM">
<datasetParameterExpression><![CDATA[$P{DATE_FROM}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="DATE_TO">
<datasetParameterExpression><![CDATA[$P{DATE_TO}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="MAIN_CUST_NUM">
<datasetParameterExpression><![CDATA[$P{MAIN_CUST_NUM}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="MAIN_PROJ_NUM">
<datasetParameterExpression><![CDATA[$P{MAIN_PROJ_NUM}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="90" uuid="d375f5a3-db9e-450d-8ac2-e1a9a6fc18fc">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement uuid="4cd206f2-6591-41a5-969c-9466034aac24" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSDATE]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20" rowSpan="1">
<textField>
<reportElement uuid="47c0d3dd-aac2-44ff-a3e5-426cd092fd54" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSDATE}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="587ce56a-9008-43be-b850-dc5397b81c3a">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement uuid="73460bc8-c487-4712-8a50-99f624a6bab5" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[TSCONO]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20" rowSpan="1">
<textField>
<reportElement uuid="ce6aaaad-562e-4e8f-9841-d51759e57035" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TSCONO}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</summary>
问题内容: 我已经开发了用于报告目的的Web应用程序。为此,我必须使用Applet在客户端查看报告。我通常可以在applet中看到报表,但是当涉及到打印时(当我单击Viewer中的“打印”按钮时),它将引发一个异常,该异常可以在Java Console中看到。我浏览了很多有关此问题的内容,并做了网上专家建议的一切。我将用作网站服务器时,在文件中添加了授予权限。此外,还向我的applet添加了授予权
问题内容: 我正在处理生成Excel文件的JasperReport报告。由于某种原因,我的单元格格式/类型不应该如此。例如,我的单元格中有Date对象,但是当我生成Excel文件时,它将单元格类型设置为Number,或者Long类型是单元格中的文本,但是单元格的格式是number,并且当用户编辑日期单元格时(例如,日期为11/02) / 2012更改为11/03/2012),它将日期转换为数字(4
我使用Jaspersoft Studio 6.3.1.final来设计一个包含表格和其他元素的报告。 设计如下所示。该表只有列标题和详细信息部分。 现在垂直打印字段,如下所示: 但我需要的是像这样水平展示它们: 我在网上搜索,没有找到任何运气。 有办法做到这一点吗?我被困在这里了。非常感谢您的帮助! 编辑: 这就是我将数据传递到报表的方式(使用现有的Java服务生成JRBeanDig
问题内容: 如何在一行中多次打印一个字符?这意味着我不能使用循环。 我正在尝试多次打印。 我尝试了这种方法,但是不起作用: 是变量。 问题答案: 您可以在同一行中进行打印,因此 可以 使用循环。而不是不添加换行符。 将打印:。
问题内容: 我有以下代码来获取地图: 如何打印带有重复键的消息“重复键”? 问题答案: 如何打印带有重复键的消息“重复键”? 使用当前代码,您将收到消息“重复键”,其中包含至少2个实例的列表,这些实例具有与对象相同的值,例如。 如何获得对应的密钥? 到目前为止,还无法获得相应的键,当前从合并功能中获得的实际上是与相同键映射的2个值,这些值需要合并以仅保留对应键的一个值。 您的问题是 Java 9
问题内容: 例如,我有两个变量,以及如何仅使用一个变量而不将类型转换为来在单独的行中打印两个整数。(如在C ++以下:) 问题答案: 在python3中: 在python2中: …或者使用python3的打印 自从我的第一个答案以来,OP就使用可变类型更改来编辑问题。更新已更新问题的答案: 如果您有一些整数,即和: Python 3: Python 2: 要么 要么