Sunday, March 25, 2012

Can we a use a CSS or equivalent for a reports(RDLC File)

Hi,

I will be using RDLC files to display reports in various pages.

My Question is this.

I need to use the same type of formatting of color,fonts,font sizes and the background colors so that the same can be used across the reports.

This is somewhat like using a CSS file for aspx pages.

Any ideas... , solution........, .......

Hi,

Just wondering!

We have CSS for the aspx and the HTML pages.

Are there no ways to set a golbal standard for the Reports( Ok, be it a Server report or a local report.). Is it not correct what I am asking.

|||I've been looking into this also, and I found some old threads stating that themes and css are not supported but that they may be in the next version.|||

Hello,

Formatting for reports can be expression based. Create your reports using a standard formula for similar items and pass in values through a dataset. Another option would be to take formatting information in as parameters. The RDL file is just an XML file, you could modify it directly if you want. Here is a link to information on programmatically generating RDLs: http://technet.microsoft.com/en-us/library/ms154583.aspx. RDLs and RDLCs are very similar, and the same techniques could be used.

Good luck,

Larry

|||I need a clarification.

How do I assign a class in the css to a text box.

Say I have a class .txtboxTahomaBold in the CSS, how do I assign the class to the textbox. I do not find any property for the controls (textbox, table .... )|||

I am sorry to have misslead you. You do not get to assign CSS to the textboxes, but you can assign the regular SSRS formatting to each text box on a report prior to displaying it. The easiest way would be to create formulas within the report based on data that you provide through a dataset. For example, set the Font formula to =FieldsTextBoxTahomaBold.Value and have the dataset pass in the string "Normal, Tahoma, 11pt, Bold". Of course, you could also modify the XML, but that is more trouble than it is worth.

I will try and get an example written up on my blog. I will post a link here when I do.

Larry

|||

Thanks.

Waiting for your reply.

|||

Formatting your report based on the user or the data is relatively straight forward once you get the trick. To demonstrate, create a report with a valid connection to an instance of Microsoft SQL Server and use the following SQL as your query:

Code Snippet

SELECT
CASE @.param
WHEN 0 THEN 'Blue'
WHEN 1 THEN 'Red'
END AS color,
CASE @.param
WHEN 0 THEN '12pt'
WHEN 1 THEN '24pt'
END AS size

and create five text boxes with the following attributes:
TextBox1
Value: Color
Color: =First(Fields!color.Value)

TextBox2
Value: Size
Font: Normal, Arial, =First(Fields!size.Value), Normal

TextBox3
Value: Both
Color: =First(Fields!color.Value)
Font: Normal, Arial, =First(Fields!size.Value), Normal

TextBox4
Value: =First(Fields!color.Value)

TextBox5
Value: =First(Fields!size.Value)

Sorry for the delay. The article at http://smithmier.com/blog/?p=38 has a picture of the results, but it really isn't required to understand the concept.

|||

Hi Larry,

Thanks for the post.

I will check it out.

No comments:

Post a Comment