jasperreport动态设置样式

style

<style name="Table_font1">
		<conditionalStyle>
			<conditionExpression><![CDATA[$F{FIRSTNAME}.startsWith("La")]]></conditionExpression>
			<style mode="Opaque" backcolor="#35D9F2" isBold="true">
				<box>
					<pen lineWidth="0.5" lineColor="#FFFFFF"/>
					<topPen lineWidth="0.5" lineColor="#FFFFFF"/>
					<leftPen lineWidth="0.5" lineColor="#FFFFFF"/>
					<bottomPen lineWidth="0.5" lineColor="#FFFFFF"/>
					<rightPen lineWidth="0.5" lineColor="#FFFFFF"/>
				</box>
			</style>
		</conditionalStyle>
		<conditionalStyle>
			<conditionExpression><![CDATA[!$F{FIRSTNAME}.startsWith("La")]]></conditionExpression>
			<style mode="Opaque" backcolor="#FFFFFF">
				<box>
					<pen lineWidth="0.5" lineColor="#000000"/>
					<topPen lineWidth="0.5" lineColor="#000000"/>
					<leftPen lineWidth="0.5" lineColor="#000000"/>
					<bottomPen lineWidth="0.5" lineColor="#000000"/>
					<rightPen lineWidth="0.5" lineColor="#000000"/>
				</box>
			</style>
		</conditionalStyle>
	</style>

use style

看Table_font1

<jr:column width="80" uuid="6701f4f7-dd62-47d1-a002-5ebeaa3167aa">
						<jr:tableHeader style="Table_TH" height="30"/>
						<jr:tableFooter style="Table_TH" height="2"/>
						<jr:columnHeader style="Table_CH" height="30">
							<staticText>
								<reportElement x="0" y="0" width="80" height="30" uuid="84e999fa-4a4e-4951-97d5-e2d06bf29978"/>
								<textElement textAlignment="Center" verticalAlignment="Middle">
									<font size="10"/>
								</textElement>
								<text><![CDATA[FIRSTNAME]]></text>
							</staticText>
						</jr:columnHeader>
						<jr:columnFooter style="Table_CH" height="2"/>
						<jr:detailCell style="Table_font1" height="30">
							<textField>
								<reportElement style="Table_font1" stretchType="RelativeToBandHeight" x="0" y="0" width="80" height="30" uuid="e712b34c-a0d1-4c47-8027-6c22aae4978e"/>
								<textElement textAlignment="Center" verticalAlignment="Middle">
									<paragraph lineSpacing="AtLeast"/>
								</textElement>
								<textFieldExpression><![CDATA[$F{FIRSTNAME}]]></textFieldExpression>
							</textField>
						</jr:detailCell>
					</jr:column>

效果

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值