Jump to content
JasperReports Library 7.0 is now available ×

Change background colour on HTML report


Recommended Posts

By: Paul Kearney - paulkearney

Change background colour on HTML report

2006-03-10 03:35

Hi,

 

(JasperReports 1.2.0)

 

I am looking to change the background colour of a one-page HTML report for presentation reasons.

 

I want to construct a report and have it displayed on top of a solid background colour.

 

So far I have tried:

 

<?xml version="1.0"?><!DOCTYPE jasperReport

PUBLIC "-//JasperReports//DTD Report Design//EN"

"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport name="SummaryReport">

 

......

 

<background>

<band height="300">

<rectangle>

<reportElement x="0" y="0" width="300" height="300" backcolor="darkGray" mode="Opaque" />

</rectangle>

</band>

</background>

 

<title>

<band height="80">

<textField>

<reportElement x="0" y="0" width="400" height="20" />

<textElement>

<font reportFont="ArialBold" />

</textElement>

<textFieldExpression class="java.lang.String">$P{reportTitle}</textFieldExpression>

</textField>

 

.....

 

</title>

 

<detail>

<band height="220">

<staticText>

<reportElement x="0" y="20" width="199" height="20" mode="Transparent" />

<text><![CDATA[Number of elements:]]></text>

</staticText>

<textField>

<reportElement x="200" y="20" width="99" height="20" mode="Transparent" />

<textElement textAlignment="Right" />

<textFieldExpression class="java.lang.Long"><![CDATA[$F{totalElements}]]></textFieldExpression>

</textField>

 

......

 

</band>

</detail>

 

</jasperReport>

 

Where I expect the <background> element to provide a solid background element and the report <title> and <detail> sections to be displayed over the top of it. The block colour being visible as the other elements are set to mode="Transparent".

 

Instead what happens is that background colour is ignored and the other elements render as they would normally have (i.e. on a white background).

 

Hope someone can help.

 

Cheers,

 

Paul

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...