Formatting Label text in an expression

Hi all,

Once again I am trying something new and need some direction. I have a label that I setup this expression for…

concat("The Selected Binder is ", {Root Container.Label 2.selectedBinderName})

It works fine, but I would like to be able to make the two different strings a different font.

Where should I look for this?

Thanks, Steven

The labels work with HTML formatting. Have you tried adding that into your string to set your font for the different sections?

You can use a selection of HTML markup tags for formatting text.
The font tag is limited though, you can only set bold,color and size I believe.

https://docs.inductiveautomation.com/display/DOC79/HTML+in+Ignition

@bpreston & @MMaynard

I am binding properties to the label in a Property Expression.

The Expression is this…

concat("The current Binder is ",{Root Container.Power Table.selectedBinderName} ,"The current Topic is ",{Root Container.Label 2.selectedTopicName})

When I try to put html here…

It looks great in design mode. But when I go to preview or the client, it does not see the html formatting.

When I try to put it in the Expression, it does not like it.

What am I missing?

Thanks, Steven

concat("<html>","The current Binder is ",{Root Container.Power Table.selectedBinderName} ,"<font color='red'><b>","The current Topic is ",{Root Container.Label 2.selectedTopicName},"</b></font></html>")
1 Like

Ah, I see the html formats the entire string not each string separately.

concat("<html>The current Binder is <b>", {Root Container.Power Table.selectedBinderName}, "<br></b>The current Topic is <b>", {Root Container.Label 2.selectedTopicName})

So this gives me bold and line break right where I want it.

Thanks for the help!!

Steven

1 Like