如何在iReport中为整个页面设置背景颜色? [英] How to set background color to entire page in iReport?
本文介绍了如何在iReport中为整个页面设置背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用iReport 3.7.4。
我想为整个页面设置背景颜色。我没有找到任何背景颜色的报告属性。
任何人都可以帮助我吗?
I am using iReport 3.7.4. I want to set background color to entire page.I didn't found any report property for background color. Can anyone help me in this?
推荐答案
你可以在的帮助下解决问题背景乐队
。
我在上放了
并将 staticText
元素背景乐队模式
属性设置为 不透明
并设置 backcolor
属性。
I've put staticText
element on Background Band
and set mode
attribute as Opaque
and set the backcolor
property.
样本:
<jasperReport ... pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="338"/>
<queryString language="xPath">
<![CDATA[/Northwind/Customers]]>
</queryString>
<field name="CustomerID" class="java.lang.String">
<fieldDescription><![CDATA[CustomerID]]></fieldDescription>
</field>
<field name="CompanyName" class="java.lang.String">
<fieldDescription><![CDATA[CompanyName]]></fieldDescription>
</field>
<field name="ContactName" class="java.lang.String">
<fieldDescription><![CDATA[ContactName]]></fieldDescription>
</field>
<field name="ContactTitle" class="java.lang.String">
<fieldDescription><![CDATA[ContactTitle]]></fieldDescription>
</field>
<field name="Address" class="java.lang.String">
<fieldDescription><![CDATA[Address]]></fieldDescription>
</field>
<field name="City" class="java.lang.String">
<fieldDescription><![CDATA[City]]></fieldDescription>
</field>
<field name="PostalCode" class="java.lang.String">
<fieldDescription><![CDATA[PostalCode]]></fieldDescription>
</field>
<field name="Country" class="java.lang.String">
<fieldDescription><![CDATA[Country]]></fieldDescription>
</field>
<field name="Phone" class="java.lang.String">
<fieldDescription><![CDATA[Phone]]></fieldDescription>
</field>
<field name="Fax" class="java.lang.String">
<fieldDescription><![CDATA[Fax]]></fieldDescription>
</field>
<background>
<band height="842" splitType="Stretch">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="595" height="842" backcolor="#CCFFCC"/>
<textElement/>
<text><![CDATA[]]></text>
</staticText>
</band>
</background>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement x="128" y="29" width="298" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[The report with the background color]]></text>
</staticText>
</band>
</title>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="19" y="0" width="147" height="20"/>
<box leftPadding="10"/>
<textElement/>
<textFieldExpression><![CDATA[$F{CompanyName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="166" y="0" width="260" height="20"/>
<box leftPadding="10"/>
<textElement/>
<textFieldExpression><![CDATA[$F{City}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
背景乐队
的高度应该是等于整个报告的高度,透明 staticText
元素必须占据此频段的整个空间。
The height of the Background Band
should be equal to the whole report's height and the "transparent" staticText
element must occupy the entire space of this band.
结果将是:
The result will be:
这篇关于如何在iReport中为整个页面设置背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文