我目前的家长报告:
<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="mainTemplate" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="774" leftMargin="25" rightMargin="43" topMargin="10" bottomMargin="43" uuid="f6278978-d9b2-42df-8b72-6557197bf6bf">
<style name="footer" vAlign="Middle" fontName="Verdana" fontSize="9" isBold="true" pdfFontName="fonts/verdanabd.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
<parameter name="objectCode" class="java.lang.Integer"/>
<parameter name="objectDescrition" class="java.lang.String"/>
<parameter name="pages" class="java.util.List"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
<parameter name="pageNumberTitle" class="java.lang.String"/>
<queryString language="SQL">
<![CDATA[]]>
</queryString>
<detail>
<band height="45" splitType="Stretch">
<rectangle>
<reportElement x="2" y="2" width="771" height="25" backcolor="#E0E0E0" uuid="664a8b98-1aef-491f-82b0-4a6ffea7081f"/>
<graphicElement>
<pen lineWidth="0.0" lineStyle="Solid"/>
</graphicElement>
</rectangle>
<textField>
<reportElement style="footer" x="16" y="2" width="491" height="25" uuid="56521af5-f104-4bbd-b6ab-fd7b6b502dca"/>
<textElement markup="html"/>
<textFieldExpression><![CDATA["<span style='font-weight: bold;'></span>" + $P{objectDescrition}]]></textFieldExpression>
</textField>
<subreport>
<reportElement x="0" y="30" width="771" height="15" uuid="87b6f002-8f10-4b20-9e3f-b6d2bb73037a"/>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRMapCollectionDataSource($P{pages})]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "exportCommentsWithMarks.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
</jasperReport>
子报表:
<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="exportCommentsWithMarks" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="774" leftMargin="25" rightMargin="43" topMargin="10" bottomMargin="43" uuid="b5753b46-4511-49e4-8a4c-faebef13bd0b">
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
<field name="comments" class="java.util.List"/>
<field name="media" class="java.awt.Image"/>
<detail>
<band height="400" splitType="Stretch">
<subreport>
<reportElement x="392" y="0" width="379" height="71" isRemoveLineWhenBlank="true" uuid="adf5d1b5-9361-4d5e-9ee7-4d1bde126198"/>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRMapCollectionDataSource($F{comments})]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "marksReport.jasper"]]></subreportExpression>
</subreport>
<image isUsingCache="true" isLazy="true">
<reportElement x="28" y="35" width="351" height="365" uuid="6ebaced5-b797-404c-a893-8fa689f8e09d"/>
<imageExpression><![CDATA[$F{media}]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>
我希望在主报表的矩形和textField之后立即放置子报表,而不会分页。
答案 0 :(得分:1)
设置所有splitType="Immediate"
并检查子报表的高度(包括边距)是否适合高度= 595-53(边距)-30(子报表位置)= 512