Formatting literals in an expression

We may want to make label for our textboxes: Category, Subcategory, and Product:

  • Category: Accessories
  • Subcategory: Tires and Tubes
  • Product: Patch kit / 8 patches, mountain tire tube, road tire tube

Prior to SQL Server Reporting Services 2008, you can only do that by creating two separate textboxes, so you can set separate font styles for each textbox.

SSRS 2008 and above have another property, called placeholder, that allows us to set different styles for literals and expressions within a single textbox. Let's do that:

  1. Go back to the designer, highlight the <<Expr>> in the first textbox and right-click on it, then select Placeholder Properties:
    Formatting literals in an expression
  2. That displays the Placeholder Properties dialog box. Click on the expression builder button next to the Value drop-down list (the button labeled fx). Change the expression to:
    ="<B>Category:</B> " & Parameters!Category.Value(0)
    
  3. Click on OK when done.
  4. Going back to Placeholder Properties, select HTML-Interpret HTML tags as styles for the markup type. Then click on OK.

    Formatting literals in an expression

  5. Do the same for the Subcategory and Product expressions.

    You can also format the value in a textbox as a plain text by setting its format in the Placeholder Properties dialog box. In our example, we can make the expression bold by setting its Font property to Bold in the Font tab.

You can have multiple placeholders in a single textbox. All placeholders can be formatted individually.

Run the report to see the changes. We should now have Category:, Subcategory:, and Product: in bold.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.188.201