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,&nbsp 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)

Leave a Comment
  • Please add 3 and 4 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • TNJMAN edited Revision 19. Comment: Mega-bling

  • TNJMAN edited Revision 18. Comment: Spiffaroonie!

  • TNJMAN edited Revision 16. Comment: More bling

  • TNJMAN edited Revision 15. Comment: Spiffier

  • TNJMAN edited Revision 14. Comment: Further clarification

  • TNJMAN edited Revision 13. Comment: Making it more pretty / prettier

  • TNJMAN edited Revision 12. Comment: More beautification

  • TNJMAN edited Revision 11. Comment: Smoothification

  • TNJMAN edited Revision 10. Comment: More clarification

  • TNJMAN edited Revision 9. Comment: minor clarification

Page 1 of 2 (12 items) 12
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Naomi  N edited Original. Comment: Great article - needs to be included into TechNet Contributions

  • Congratulations on winning the gold medal! blogs.technet.com/.../technet-guru-awards-july-2013.aspx

  • Thanks Ed !!

  • This was featured on the Wiki Ninjas blog: blogs.technet.com/.../july-ssrs-guru-sathyanarrayanans-brings-us-quot-multi-font-color-multi-font-size-within-a-single-field-textbox-quot.aspx

    And on MSDN blogs: blogs.msdn.com/.../ssrs-guru-multi-font-color-multi-font-size-within-a-single-field-textbox.aspx

    And on the home page of TNWiki: social.technet.microsoft.com/.../default.aspx

  • And you're welcome! =^)

  • Maheshkumar S Tiwari edited Revision 8. Comment: minor edit

  • Well-deserved.This is incredibly nicely crafted!

  • TNJMAN edited Revision 9. Comment: minor clarification

  • TNJMAN edited Revision 10. Comment: More clarification

  • TNJMAN edited Revision 11. Comment: Smoothification

  • TNJMAN edited Revision 12. Comment: More beautification

  • TNJMAN edited Revision 13. Comment: Making it more pretty / prettier

  • TNJMAN edited Revision 14. Comment: Further clarification

  • TNJMAN edited Revision 15. Comment: Spiffier

  • TNJMAN edited Revision 16. Comment: More bling

Page 1 of 2 (19 items) 12