Change font within sub

I have a report which shows surname or full name if a first name exists. I would like the first name to have a smaller font size than surname. If I use the procedure below I get the full name when I need it, but how can I change the font on the first name only?

 If Report.GetColumnValue("Register.FullName") <> "" Then

    NameText.Text = Report.GetColumnValue("Surname") + " (" + Report.GetColumnValue("FirstName") + ")"

   Else

    NameText.Text = Report.GetColumnValue("Surname")

   End If  

Comments

  • Hello!

    To display the surname in a standard font and the first name in brackets in a smaller font within a single TextObject, enable HTML tags on the object (TextRenderType = HtmlTags; in older versions, set the HtmlTags property to true) and construct a string using the <font size="..."> tag:

    If String.IsNullOrEmpty(firstName) Then
    NameText.Text = surname
    Else
    NameText.Text = surname & ‘ <font size=""8’‘>(’ & firstName & ‘)</font>’
    End If
    

    Please ensure that TextRenderType = HtmlTags is selected in the NameText properties (otherwise the tags will be displayed as plain text).

This discussion has been closed.