Programming using the BIRT Reporting APIs : Programming the structure of a report design : Using a report item in a report design : How to change a complex property of a report item
 
How to change a complex property of a report item
The code sample in Listing 12‑20 shows how to use PrivateStyleHandle and ColorHandle objects to change the background color of a label. The variable, design, is a ReportDesignHandle object. This sample accesses the label by name. Alternatively, access a report item by navigating the report structure.
Listing 12‑20 Changing a complex property of a report item
// Access the label by name.
LabelHandle headerLabel = ( LabelHandle ) design.findElement( "Header Label" );
try {
// To prepare to change a style property, get a StyleHandle.
StyleHandle labelStyle = headerLabel.getPrivateStyle();
// Update the background color.
ColorHandle bgColor = labelStyle.getBackgroundColor();
bgColor.setRGB( 0xFF8888 );
} catch ( Exception e ) {
// Handle the exception
}