SSRS: Multi Font Color / Multi Font Size within a Single Field / Textbox

SSRS: Multi Font Color / Multi Font Size within a Single Field / Textbox

This article explains how to format the characters within a single Field or Textbox with varying font size and font color in SSRS.

Consider the below code sample as the requisite dataset query:

DECLARE @UnitsOfMeasurement TABLE (Measurement VARCHAR(50),Units VARCHAR(20))
INSERT @UnitsOfMeasurement SELECT 'Area','m2'
INSERT @UnitsOfMeasurement SELECT 'Volume','m3'
INSERT @UnitsOfMeasurement SELECT 'Luminance','cd/m2'
INSERT @UnitsOfMeasurement SELECT 'Time','s'
INSERT @UnitsOfMeasurement SELECT 'Electric current','A'
SELECT * FROM @UnitsOfMeasurement

I have added a single column on the report as shown in the screenshot below:

The expression for the UnitsOfMeasurement column is as follows:
= Fields!Measurement.Value + " - " +  Fields!Units.Value





To format the UnitsOfMeasurement column in such a way that  Fields!Measurement.Value and Fields!Units.Value will appear in a different font color and  size,  follow the steps below:

Click inside the Data row of the column as shown below:





Select Create Placeholder ... - > Placeholder Properties - >  General - > Markup type - >  HTML - Interpret HTML tags  as styles (select this option)

In the same window, select Create Placeholder ... - > Placeholder Properties - >  General - >  and then click on expression (fx) - > and then paste the below expression:

 
="<font color = 'blue' size = '4'>" + Fields!Measurement.Value + "</font>"
+" - "
"<font color = 'red' size = '2'>" + Fields!Units.Value + "</font>"




Below is the resultant report: (Each field is now formatted with multicolored, multi-sized fonts within each text box)

  




See Also


List of Award Winning TechNet Guru Articles
SQL Server Reporting Services Portal

Sort by: Published Date | Most Recent | Most Useful
Comments
Page 1 of 1 (8 items)