论坛首页 Java企业应用论坛

ireport制作报表边界线问题

浏览 3679 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-05-08  
    我用的ireport2.0.5,在ireport中的显示如图1,其中汉字部分我用‘*’代替了,在ireport中显示是有线的,(我是改的border选项卡下的line-width为1,line-style为实线),可到了导出excel的时候标题,数据都有,线都没了,哪位遇到过这种情况或对报表制作比较熟悉的指导下。

    我用的是webwork2.2.5,后台逻辑非常简单就是查询出结果放到reportList中,在报表中做字段对应,报表本身并没有什么逻辑),只作显示用(而数据正确显示说明数据是取到了只是格式问题),xwork.xml代码如下
<action name="export1" class="com.ncs.jzdd.action.AssortReportAction">
			<result name="success" type="jasper">
				<param name="location">jasper\sqmple11.jasper</param>
				<param name="format">XLS</param>
				<param name="dataSource">reportList</param>
			</result>
		</action>  


sqmple11.jrxml
代码如下
<?xml version="1.0" encoding="UTF-8"  ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
		 name="sqmple2"
		 columnCount="1"
		 printOrder="Vertical"
		 orientation="Portrait"
		 pageWidth="595"
		 pageHeight="842"
		 columnWidth="535"
		 columnSpacing="0"
		 leftMargin="30"
		 rightMargin="30"
		 topMargin="20"
		 bottomMargin="20"
		 whenNoDataType="NoPages"
		 isTitleNewPage="false"
		 isSummaryNewPage="false">
	<property name="ireport.scriptlethandling" value="0" />
	<property name="ireport.encoding" value="UTF-8" />
	<import value="java.util.*" />
	<import value="net.sf.jasperreports.engine.*" />
	<import value="net.sf.jasperreports.engine.data.*" />



	<field name="deptname" class="java.lang.String"/>
	<field name="taskaddnum" class="java.lang.Integer"/>
	<field name="taskdelnum" class="java.lang.Integer"/>
	<field name="addobjnum1" class="java.lang.Integer"/>
	<field name="delobjnum1" class="java.lang.Integer"/>
	<field name="addobjnum2" class="java.lang.Integer"/>
	<field name="delobjnum2" class="java.lang.Integer"/>
	<field name="addobjnum3" class="java.lang.Integer"/>
	<field name="delobjnum3" class="java.lang.Integer"/>
	<field name="addobjnum4" class="java.lang.Integer"/>
	<field name="delobjnum4" class="java.lang.Integer"/>

		<background>
			<band height="0"  isSplitAllowed="true" >
			</band>
		</background>
		<title>
			<band height="50"  isSplitAllowed="true" >
			</band>
		</title>
		<pageHeader>
			<band height="50"  isSplitAllowed="true" >
				<staticText>
					<reportElement
						x="25"
						y="0"
						width="488"
						height="50"
						key="staticText-1"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="18" isBold="true"/>
					</textElement>
				<text><![CDATA[***管理系统(报2)]]></text>
				</staticText>
			</band>
		</pageHeader>
		<columnHeader>
			<band height="82"  isSplitAllowed="true" >
				<staticText>
					<reportElement
						x="91"
						y="0"
						width="88"
						height="35"
						key="staticText-3"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[****]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="179"
						y="0"
						width="81"
						height="35"
						key="staticText-6"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[****(个)]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="260"
						y="0"
						width="92"
						height="35"
						key="staticText-9"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[****(个)]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="352"
						y="0"
						width="83"
						height="35"
						key="staticText-12"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[****(个)]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="435"
						y="0"
						width="78"
						height="35"
						key="staticText-15"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[***(个)]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="25"
						y="0"
						width="66"
						height="80"
						key="staticText-2"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[****]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="91"
						y="35"
						width="46"
						height="45"
						key="staticText-4"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[增]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="137"
						y="35"
						width="42"
						height="45"
						key="staticText-5"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[删]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="179"
						y="35"
						width="39"
						height="45"
						key="staticText-7"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[增]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="218"
						y="35"
						width="42"
						height="45"
						key="staticText-8"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[删]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="260"
						y="35"
						width="46"
						height="45"
						key="staticText-10"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[增]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="306"
						y="35"
						width="46"
						height="45"
						key="staticText-11"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[删]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="352"
						y="35"
						width="41"
						height="45"
						key="staticText-13"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[增]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="393"
						y="35"
						width="42"
						height="45"
						key="staticText-14"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[删]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="435"
						y="35"
						width="33"
						height="45"
						key="staticText-16"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[增]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="468"
						y="35"
						width="45"
						height="45"
						key="staticText-17"/>
					<box>					<pen lineWidth="1.0" lineStyle="Solid"/>
					<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>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[删]]></text>
				</staticText>
			</band>
		</columnHeader>
		<detail>
			<band height="43"  isSplitAllowed="true" >
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="zh"
						x="25"
						y="5"
						width="66"
						height="33"
						key="textField-1"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA[$F{deptname}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="zh"
						x="179"
						y="5"
						width="36"
						height="33"
						key="textField-2"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$F{addobjnum1}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="zh"
						x="218"
						y="5"
						width="46"
						height="33"
						key="textField-3"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$F{delobjnum1}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="zh"
						x="135"
						y="5"
						width="37"
						height="33"
						key="textField-4"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$F{taskdelnum}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="zh"
						x="264"
						y="5"
						width="42"
						height="33"
						key="textField-5"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$F{addobjnum2}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="zh"
						x="311"
						y="5"
						width="44"
						height="33"
						key="textField-6"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$F{delobjnum2}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="zh"
						x="352"
						y="5"
						width="43"
						height="33"
						key="textField-7"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$F{addobjnum3}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="zh"
						x="395"
						y="5"
						width="40"
						height="33"
						key="textField-8"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$F{delobjnum3}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="zh"
						x="435"
						y="5"
						width="33"
						height="33"
						key="textField-9"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$F{addobjnum4}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="zh"
						x="468"
						y="5"
						width="45"
						height="33"
						key="textField-10"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$F{delobjnum4}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="zh"
						x="91"
						y="5"
						width="46"
						height="33"
						key="textField-11"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$F{taskaddnum}]]></textFieldExpression>
				</textField>
			</band>
		</detail>
		<columnFooter>
			<band height="30"  isSplitAllowed="true" >
			</band>
		</columnFooter>
		<pageFooter>
			<band height="50"  isSplitAllowed="true" >
			</band>
		</pageFooter>
		<lastPageFooter>
			<band height="50"  isSplitAllowed="true" >
			</band>
		</lastPageFooter>
		<summary>
			<band height="50"  isSplitAllowed="true" >
			</band>
		</summary>
</jasperReport>

论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics