目前,我的ireport会垂直生成报告,所有数据都会正确显示。例如:
1 LM Test 1 LM
1T2e0st92 Elm
SStprreientgfield, TX
20192
{Hard Copy - Regular
Mail}
当我将报告转换为水平报告时,它会删除最后一行" {Hard Copy - Regular Mail}"只打印出来:
1 LM Test 1 LM
1T2e0st92 Elm
SStprreientgfield, TX
20192
以下是水平报告的xml代码:
<?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="Service Sheet Preview" columnCount="2" printOrder="Horizontal" pageWidth="612" pageHeight="792" columnWidth="286" 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"/>
<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>
</style>
<subDataset name="Recipients">
<field name="RECIPIENTS" class="java.lang.String"/>
</subDataset>
<parameter name="CSNL_ID" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="DOC_ID" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="PREVIEW" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select
distinct(csnl.id),
STUFF(
(SELECT ', ' + clmt.C_LAST_NAME + ', ' + clmt.C_FIRST_NAME + ' V. ' + emplr.C_LAST_NAME + ', ' + emplr.C_FIRST_NAME
from T_CSNL_RELATED_CASE d
inner join T_CASE_INPUT c on d.C_CASE_ID = c.ID
left join T_CONTACT clmt on cast(c.C_CLAIMANT_ID as int) = clmt.ID
left join T_CONTACT emplr on cast (c.C_EMPLOYER_ID as int) = emplr.ID
where d.ID_BASE = csnl.id
FOR XML PATH(''))
, 1,1,'')
as CASE_NAME,
STUFF(
(SELECT ', ' + C_CASE_NUMBER
from T_CSNL_RELATED_CASE d
where d.ID_BASE = csnl.id
FOR XML PATH(''))
, 1,1,'') AS CASE_NUMBER,
(select c_title from t_document doc where id = $P{DOC_ID}) as TITLE,
case when datepart(dd, getdate()) in(01, 21, 31) then convert(varchar, datepart(dd, getdate()))+'st'
when datepart(dd, getdate()) in(02, 22) then convert(varchar, datepart(dd, getdate()))+'nd'
when datepart(dd, getdate()) in(03, 23) then convert(varchar, datepart(dd, getdate()))+'rd'
else convert(varchar, datepart(dd, getdate()))+'th'
end as DAY,
datename(mm, getdate()) as MONTH,
datepart(yyyy, getdate()) as YEAR,
case when ct.c_title is null OR ct.c_title = '' then '' else ct.c_title+'<br>' end+
case when ct.c_organization is null OR ct.c_organization = '' then '' else ct.c_organization+'<br>' end+
ct.c_first_name+' '+ct.c_last_name +'<br>'+
dbo.OALJ_getContactAddress(ct.id, default) +'<br>'
+'<br> {'+dt.c_name+'}'
as RECIPIENTS,
rcpts.C_ORDER as displayOrder
from t_csnl csnl
join t_csnl_related_case csnlRC on csnl.id = csnlRC.id_base
join (select id_base, c_contact, c_delivery_type, c_order from T_CSNL_ESR_RCPTS where id_base = $P{CSNL_ID}
UNION select id_base, c_contact, c_delivery_type, c_order from T_CSNL_HARD_COPY_RCPTS where id_base = $P{CSNL_ID}
UNION select id_base, c_contact, c_delivery_type, c_order from T_CSNL_STANDARD_RCPTS where id_base = $P{CSNL_ID}) rcpts on csnl.id = rcpts.id_base
join t_contact ct on ct.id = rcpts.c_contact
join t_csnl_delivery_type dt on dt.id = rcpts.c_delivery_type
join t_case_input cs on csnlRC.c_case_id = cs.id
join t_document doc on doc.id = $P{DOC_ID}
where csnl.id = $P{CSNL_ID} ORDER BY displayOrder ASC, 8 ASC]]>
</queryString>
<field name="id" class="java.math.BigDecimal"/>
<field name="CASE_NAME" class="java.lang.String"/>
<field name="CASE_NUMBER" class="java.lang.String"/>
<field name="TITLE" class="java.lang.String"/>
<field name="DAY" class="java.lang.String"/>
<field name="MONTH" class="java.lang.String"/>
<field name="YEAR" class="java.lang.Integer"/>
<field name="RECIPIENTS" class="java.lang.String"/>
<field name="displayOrder" class="java.lang.Integer"/>
<variable name="RUNDATE" class="java.lang.String">
<variableExpression><![CDATA[(new SimpleDateFormat("yyyy/MM/dd")).format(new Date())]]></variableExpression>
</variable>
<group name="ReportGroup1">
<groupExpression><![CDATA[$F{CASE_NAME}]]></groupExpression>
<groupHeader>
<band height="148">
<staticText>
<reportElement x="0" y="20" width="100" height="20"/>
<textElement>
<font fontName="Times New Roman"/>
</textElement>
<text><![CDATA[Case Number:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="100" y="20" width="472" height="20"/>
<textElement>
<font fontName="Times New Roman" isBold="true" pdfFontName="Times-Bold"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{CASE_NUMBER}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="0" y="40" width="100" height="20"/>
<textElement>
<font fontName="Times New Roman"/>
</textElement>
<text><![CDATA[Document Title:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="100" y="40" width="472" height="20"/>
<textElement>
<font fontName="Times New Roman" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{TITLE}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="0" y="0" width="100" height="20"/>
<textElement>
<font fontName="Times New Roman"/>
</textElement>
<text><![CDATA[Case Name:]]></text>
</staticText>
<textField>
<reportElement x="100" y="0" width="472" height="20"/>
<textElement>
<font fontName="Times New Roman" isBold="true" pdfFontName="Times-Bold"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{CASE_NAME}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="60" width="572" height="28"/>
<textElement>
<font fontName="Times New Roman"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["I hereby certify that a copy of the above-referenced document was sent to the following this "+$F{DAY}+" day of "+$F{MONTH}+", "+$F{YEAR}+":"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="88" width="572" height="60"/>
<textElement>
<font fontName="Times New Roman" size="14" isBold="true" isItalic="true" isUnderline="false"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[" "]]></textFieldExpression>
</textField>
</band>
</groupHeader>
</group>
<background>
<band height="752" splitType="Stretch">
<printWhenExpression><![CDATA[$P{PREVIEW}.equals( "Yes" )]]></printWhenExpression>
<staticText>
<reportElement x="0" y="92" width="572" height="64" forecolor="#CCCCCC" backcolor="#FFFFFF"/>
<textElement textAlignment="Center">
<font size="48" isBold="true"/>
</textElement>
<text><![CDATA[PREVIEW]]></text>
</staticText>
<staticText>
<reportElement x="0" y="220" width="572" height="64" forecolor="#CCCCCC"/>
<textElement textAlignment="Center">
<font size="48" isBold="true"/>
</textElement>
<text><![CDATA[PREVIEW]]></text>
</staticText>
<staticText>
<reportElement x="0" y="348" width="572" height="64" forecolor="#CCCCCC"/>
<textElement textAlignment="Center">
<font size="48" isBold="true"/>
</textElement>
<text><![CDATA[PREVIEW]]></text>
</staticText>
<staticText>
<reportElement x="0" y="476" width="572" height="64" forecolor="#CCCCCC"/>
<textElement textAlignment="Center">
<font size="48" isBold="true"/>
</textElement>
<text><![CDATA[PREVIEW]]></text>
</staticText>
<staticText>
<reportElement x="0" y="604" width="572" height="64" forecolor="#CCCCCC"/>
<textElement textAlignment="Center">
<font size="48" isBold="true"/>
</textElement>
<text><![CDATA[PREVIEW]]></text>
</staticText>
</band>
</background>
<title>
<band height="34" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="572" height="27"/>
<textElement textAlignment="Center">
<font fontName="Times New Roman" size="20" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[SERVICE SHEET]]></text>
</staticText>
</band>
</title>
<detail>
<band height="42">
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="284" height="20" isPrintWhenDetailOverflows="true"/>
<textElement markup="html">
<font fontName="Times New Roman" pdfFontName="Times-Roman" isPdfEmbedded="true"/>
<paragraph spacingAfter="20"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{RECIPIENTS}+" "]]></textFieldExpression>
</textField>
</band>
</detail>
<summary>
<band height="50">
<printWhenExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()==0)]]></printWhenExpression>
<staticText>
<reportElement x="0" y="30" width="572" height="20"/>
<textElement textAlignment="Center">
<font size="12"/>
</textElement>
<text><![CDATA[Your selection has returned no results]]></text>
</staticText>
</band>
</summary>
</jasperReport>
答案 0 :(得分:0)
所以这个问题的主要问题是场地的高度。我将字段的高度更改为120并且工作正常:
<li class="class1">
......
<li></li>
......
</li>