SSRS #71 – Cannot Format Expressions, Format Placeholders Instead
Placeholder is a perfect solution for formatting substrings inside a textbox
Formatting substrings inside a textbox in SSRS 2008 is no longer a problem.
In the following example, one textbox can hold both the bolded and underlined title “Report Definition”, and also the unformatted text.
What if the actual report definition text is dynamically set in my report (say it comes from a dataset, a parameter, or a variable), and I still want to keep only the title bold and underlined, and leave the definition text unformatted?
Placeholder in SSRS 2008 and above is a perfect solution for the scenario.
In this example, I’ve decided to place three table fields into one column, having a bold and underlined title for each field, and leaving the texts unformatted.
I’ve tried creating an expression that combines all three fields together, which has lead me nowhere in terms of formatting sub strings inside the expression.
Get to the Placeholder Menu
Formatting placeholders are pretty easy. That is, if you know how to access the placeholder feature. I find that there are many wonderful and very useful implementations in SSRS 2008 and above, compared to SSRS 2005. But Microsoft has decided to hide them from developers. One example is the Advanced Mode, with which we can achieve features such as fixing data on pages, or repeating data on every page etc. But accessing the Advanced Mode is not immediately obvious. Placeholder is another very useful feature, but not immediately obvious either.
To create placeholders inside a standalone textbox, click inside the textbox once to make sure that the cursor is placed inside the textbox, and then do a right click. The “Create Placeholder…” menu should be available.
To create placeholders inside a textbox in a Tablix or Matrix, you need to click inside the textbox twice to make sure that the cursor is placed inside the textbox, and then do a right click.
To edit a placeholder inside a textbox (standalone or not) , you need to highlight the placeholder by clicking on the placeholder once (your cursor needs to be inside the textbox first), and then do a right click. The “Placeholder Properties….” menu should be available.
Formatting substrings is one application of the placeholders. Do you have other application examples?