Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
A single column on the report has been added 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)