[Webinar] Streamline your web hosting managementRegister Today


The Power Of The Placeholder

Published on
21,514 Points
7 Endorsements
Last Modified:
1998: C++ - SQL Server 6.5
2000-2007: C++, VB6, C#, java - SQL Server 7.0-2005
2008-...: SQL Server 2005-2016
2014-2016: MVP Data Platform
The following little narrative will show you a new feature of SQL Server 2008 Reporting Services: support for rich-text.

Once upon a time in a Business Intelligence Development Studio 2005 Reporting Services solution there liveth a Textbox object which developers could use to put text on a report.  It was a fairly simple object, allowing only two ways of programming the text.

The first and most simple way of the two was to type plain and simple text directly into the box:
 SSRS Textbox with simple constant text
And the second, more advanced way, alloweth developers to use an expression to create the text dynamically.  With this they could combine data from several sources into the same Textbox:
 SSRS Edit Expression window
Then developers realized that something was still missing.  Text could be created dynamically but they also wanted to optimize the way the text looketh.  So they selected part of the expression and tried to change some font properties.  But alas, they couldn't.  It was all or nothing:
 Text rendered using some font styles in SSRS 2005
Then arriveth the day of the birth of the successor to BIDS 2005.  As the family's tradition went, it was called the same as its parent.  The only difference was its birth year: BIDS 2008.

And developers started exploring BIDS 2008 and discovereth that the Textbox object had gotten an upgrade.  When editing the content of the textbox, the right-click menu has gotten a new item:
 SSRS 2008 Create Placeholder menu item
That's right, Create Placeholder.  And this was the moment in time when developers started to have fun again.  The placeholder can be given a value through an expression, just like the olden days:
 Placeholder Properties - General tab
The Placeholder's value can be given a format through the Number tab:
 Placeholder Properties - Number tab
And a Placeholder's font can be customized:
 Placeholder Properties - Font tab
Now you may ask yourselves, wherein lies the difference with the olden days?

Well, it lies in the fact that several Placeholders and regular constant text can all be combined in the same Textbox!

This is what it looks like in Design time:
 SSRS 2008 textbox with placeholders
And rendered in Preview:
 SSRS 2008 Preview of textbox content
Powertip: to easily open up the properties of an existing Placeholder, single-click the Textbox to select it, again single-click to edit the content, then double-click a Placeholder to get its properties window.

When reports developed using BIDS 2005 are attached to a 2008 SSRS solution, any expressions in textboxes are acting as a placeholder as well:
 Textbox with expression converted to BIDS 2008
And developers liveth happily ever after.

Although not entirely.  Try entering a chemical formula in the textbox.  Indeed, there's no subscript option in the font settings.  And it doesn't work through HTML either, as explained in this Microsoft Connect bug report.  It's probably not as easy as it sounds, but if Word can do it I think so should SSRS.

A possible workaround for the subscript limitation is the following: if subscript is not possible, try putting the numbers in a smaller font than the other characters.  The workaround doesn't look as good as with subscript but better than just in regular font size.  At least, that's my opinion.  Here's a screenshot to show what it looks like when rendered that way:
 Workaround for subscript limitation: an example

If you liked this article, please don't hesitate to hit that YES button down below.  And thank you for reading what I write!

Happy reporting,
1 Comment

Expert Comment


Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Join & Write a Comment

This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Next Article:

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month