Home > SSRS Expert > SSRS #71 – Cannot Format Expressions, Format Placeholders Instead

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.  

image

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.   

image

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.

image  

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.

image

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.

image

Formatting substrings is one application of the placeholders. Do you have other application examples?

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: