⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jdbcdatasourcereport.jrxml

📁 用报表开发工具开发各种报表的小例子
💻 JRXML
字号:
<?xml version="1.0" encoding="GB2312"  ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
		 name="jdbcdatasourceReport"
		 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="GB2312" />
	<import value="java.util.*" />
	<import value="net.sf.jasperreports.engine.*" />
	<import value="net.sf.jasperreports.engine.data.*" />

	<parameter name="rptToday" isForPrompting="false" class="java.lang.String">
		<defaultValueExpression ><![CDATA["2007-11-27"]]></defaultValueExpression>
	</parameter>
	<queryString><![CDATA[select category,value from idedata]]></queryString>

	<field name="category" class="java.lang.String"/>
	<field name="value" class="java.lang.Float"/>

	<variable name="colIndex" class="java.lang.Integer" resetType="Report" calculation="Count">
		<variableExpression><![CDATA["1"]]></variableExpression>
	</variable>
		<background>
			<band height="0"  isSplitAllowed="true" >
			</band>
		</background>
		<title>
			<band height="50"  isSplitAllowed="true" >
				<staticText>
					<reportElement						x="67"						y="0"						width="352"						height="48"						forecolor="#FF3366"						key="staticText-5"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement textAlignment="Center">
						<font size="24" isBold="true" isItalic="false"/>
					</textElement>
				<text><![CDATA[JDBCDataSource测试]]></text>
				</staticText>
				<line direction="TopDown">
					<reportElement						x="-27"						y="49"						width="588"						height="0"						key="line-1"/>
					<graphicElement stretchType="NoStretch"/>
				</line>
			</band>
		</title>
		<pageHeader>
			<band height="50"  isSplitAllowed="true" >
				<staticText>
					<reportElement						x="109"						y="9"						width="117"						height="30"						key="staticText-7"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font size="18" isBold="true"/>
					</textElement>
				<text><![CDATA[制表日期:]]></text>
				</staticText>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement						x="219"						y="9"						width="163"						height="26"						key="textField-4"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font size="18"/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA[$P{rptToday}]]></textFieldExpression>
				</textField>
			</band>
		</pageHeader>
		<columnHeader>
			<band height="30"  isSplitAllowed="true" >
				<staticText>
					<reportElement						x="155"						y="2"						width="51"						height="26"						key="staticText-3"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font size="18" isBold="true"/>
					</textElement>
				<text><![CDATA[类型]]></text>
				</staticText>
				<staticText>
					<reportElement						x="335"						y="1"						width="60"						height="27"						key="staticText-4"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font size="18" isBold="true"/>
					</textElement>
				<text><![CDATA[比例]]></text>
				</staticText>
				<staticText>
					<reportElement						x="55"						y="2"						width="41"						height="26"						key="staticText-6"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font size="18" isBold="true" pdfEncoding ="UniGB-UCS2-H"/>
					</textElement>
				<text><![CDATA[序号]]></text>
				</staticText>
				<line direction="TopDown">
					<reportElement						x="-31"						y="0"						width="593"						height="0"						key="line-2"/>
					<graphicElement stretchType="NoStretch"/>
				</line>
				<line direction="TopDown">
					<reportElement						x="-30"						y="29"						width="595"						height="0"						key="line-3"/>
					<graphicElement stretchType="NoStretch"/>
				</line>
			</band>
		</columnHeader>
		<detail>
			<band height="31"  isSplitAllowed="true" >
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement						x="154"						y="5"						width="125"						height="23"						key="textField-1"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font size="14"/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA[$F{category}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement						x="342"						y="2"						width="78"						height="26"						key="textField-2"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font size="14"/>
					</textElement>
				<textFieldExpression   class="java.lang.Float"><![CDATA[$F{value}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement						x="55"						y="0"						width="86"						height="28"						key="textField-3"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font size="14"/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$V{colIndex}]]></textFieldExpression>
				</textField>
				<line direction="TopDown">
					<reportElement						x="-31"						y="30"						width="593"						height="0"						key="line-4"/>
					<graphicElement stretchType="NoStretch"/>
				</line>
			</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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -