Bold the particular text in SSRS

空扰寡人 提交于 2019-12-06 10:15:35

问题


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)


回答1:


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



回答2:


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

Here's! an excellent tutorial.



来源:https://stackoverflow.com/questions/14247372/bold-the-particular-text-in-ssrs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!