http://reddymsbitools.blogspot.com

Saturday, 26 February 2011

code for display the colors on headers&footers

Using Reporting Services Embedded Code
Let's start with the fastest way to apply styles to a Reporting Services report, using embedded code. For this example we will only set colour styles, in order to make the example simpler.

The objective is to map the following styles to the following colours

Style Name Colour
Header Blue
Footer Green
BodyText Black
Subtitle Dark Blue

This is how you do it:

Defining Styles
Open an existing report, or create a new report
Access the embedded code of a report by clicking Report/Report Properties in the BIDS menu (you need to have selected either the Data or Layout tabs for this menu option to be available). You can then select the Code tab from the Report Properties dialog – and paste or enter the following code.
Function StyleColor(ByVal Style As String) As String
Select Case UCase(Style)
Case "HEADER"
Return "LightBlue"
Case "FOOTER"
Return "SkyBlue"
Case "MAINTITLE"
Return "Purple"
Case "SUBTITLE"
Return "DarkBlue"
Case Else
Return "White"
End Select
End Function
You should have the following:



Click OK to close the dialog.

No comments:

Post a Comment