2

I have one column in my stored proc which contains following data:

abcs,defs,CA(5,6);wsdf,kdh,CA(7,8)

Now I want only data in brackets to be bold and else everything regular, like so:

abcs,defs,CA(5,6);wsdf,kdh,CA(7,8)

Chris Latta
  • 20,316
  • 4
  • 62
  • 70
user1599392
  • 165
  • 3
  • 7
  • 13
  • please check this link http://stackoverflow.com/questions/8473106/how-to-bring-partial-text-bold-in-a-textbox – Hiten004 Jan 09 '13 at 22:15
  • But I want to do this in SSRS not in ASP.net and the (5,6) and (7,8) is dynamic. – user1599392 Jan 09 '13 at 22:20
  • 2
    Share your research with us, tell us [what you've tried](http://whathaveyoutried.com) so far (and see [this](http://meta.stackexchange.com/q/156810/162730) for more in-depth info on writing questions that will give you the best answers). – Jeroen Jan 09 '13 at 22:23
  • Covers italics, but it should work for bold (assuming something similar exists in SSRS 2008). http://stackoverflow.com/questions/8703755/italicize-text-of-a-particular-row-in-a-group-of-a-matrix-in-ssrs. – Kprof Jan 09 '13 at 22:46

2 Answers2

9

Create a custom code function to bold the text: right-click on a non-design part of the report surface, choose Report Properties... and click the Code tab. Enter the following code:

Function BoldText(Text As String) As String
  return Text.Replace("(", "(<b>").Replace(")", "</b>)")
End Function

Go to your field cell and change the expression for the value from just the field value to calling this function with the field value:

=Code.BoldText(Fields!FieldToBold.Value)

Now, this bit is the key - in your cell, click on where it shows <<Expr>> so it is highlighted then right-click it and choose Placeholder Properties.... On the General tab select the radio button to activate HTML - Interpret HTML tags as styles.

Now anything between the brackets will be bolded.

Update - changing the font colour

You can also change the font's colour by using the <font> HTML tag (the following example makes anything between the brackets red and bold):

Function BoldText(Text As String) As String
  return Text.Replace("(", "(<font color=Red><b>").Replace(")", "</b></font>)")
End Function
Chris Latta
  • 20,316
  • 4
  • 62
  • 70
1

I believe you'll need to use placeholders to accomplish this.

Here's! an excellent tutorial.

RakeshP
  • 141
  • 5
  • 15