Search code examples
reporting-servicesssrs-2012

How to change font style for specific text in a cell expression - SSRS


I need to change the font style for a specific text within a cell expression in SSRS.

My default font is Arial, that I would like to keep, but some text or conditions needs to be a different font style.

For example:

... & <[font-family:'Wingdings]> IIF(Fields!Column.Value=1,chr(254),"o")<[/font-family]> <--- this is the change I need

enter image description here


Solution

  • Use placeholders. You can add static text and/or expressions and then each of them can be customised as you want.

    It's simple. Create a text box then click in the textbox to get the cursor active in it, then right-click and choose "create placeholder". To edit existing text/placeholders, just single click them (twice in some cases) to make them active then right-click to edit.

    Then it more or less acts like a text box with similar properties, you can make it an expression or just type your text, colour properties can be expressions also for each placeholder if you need to change the colour of some part of the text for certain conditions.

    In this example, I have a small dataset with two columns, in the third column I added two placeholders, each pointing to field1 and field2 respectively.

    The design looks like this.

    enter image description here

    I then selected the first placeholder, right-clicked and got to its properties.

    enter image description here

    As field one holds colours, I use this field to set the placeholder color property. I could have just set the properties manually too of course...

    enter image description here

    The final output looks like this enter image description here