Blog Post

Tip: Change Multiple Field Formats in SSRS

,

One of the things about SSRS that irritates me is that in the graphical editor, you have to set the text box properties (say, to format numbers as currency) for each individual text box…unlike Excel, where you can select multiple fields, hit CTRL-1 and format them all at once.

Here’s a better way (with some restrictions) to update the formatting for multiple text boxes.  Let’s say we’re making a grid 12 columns across, and it contains mostly currency data. Instead of right-clicking every box, let’s do this:

  • Format one cell as you’d like it (right click > TextBox Properties > Number > etc.)
  • Select View > Code. You’ll see the XML that defines the report.
  • Search for “.Value”; keep clicking “Find Next” until you arrive at the value you formatted. It will look something like this:

<Value>=Fields!Year1_Assets.Value</Value>

<Style>

<FontFamily>Tahoma</FontFamily>

<Format>’$'#,0;(‘$’#,0)</Format>

</Style>

</TextRun>

  • It’s that <Format> line we’re interested in. Copy that line.
  • Search for the next .Values, and add the <Format> line. Or, in my case, I can search for the next <FonFamily>Tahoma</FontFamily> and replace it with <FonFamily>Tahoma</FontFamily><Format>’$'#,0;(‘$’#,0)</Format>

It’s a workaround, sure. But it beats the hell out of the several-steps right-click process we were doing before. Happy reporting!

-Jen McCown

http://www.MidnightDBA.com/Jen

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating