31
Views
3
Comments
Solved
Font-size change Expression according to its characters
Question

I have an Expression with a Value: "ToUpper(GetAgendumById.List.Current.Agenda.Topic)". What I want to get is that when this same Expression exceeds 30 characters. Its font-size that by default is 70px, is changed to 30px. It is that I am using it to generate a PDF cover and when downloading the document if the Expression is very long. With its default font-size, it eats the sheet. 

What I have now in its Style Classes property is the following and it doesn't work for me: If(Length(GetAgendumById.List.Current.Agenda.Topic) > 10, "font-size: 20px", "font-size :70px").


Thank you very much!

Solution

Hi @Mario Sepulveda,

You have to apply this css in the attribute property of the expression.


Thanks

Ruchi

While this will also work, using CSS classes instead of the style directly is a better approach. If for whatever reason you need to change the font sizes in the future, you'll only have to do so in a single place (the CSS in the theme).

Hi Mario,

You're in the right path to solve this. However, you have to use CSS classes in the "Style Classes" property instead of the style directly. So add to your theme 2 new CSS classes for the font sizes you need and change your expression accordingly. If you name your classes "small-font" and "big-font", it would look something like this:

If(Length(GetAgendumById.List.Current.Agenda.Topic) > 10, "small-font", "big-font") 

Solution

Hi @Mario Sepulveda,

You have to apply this css in the attribute property of the expression.


Thanks

Ruchi

While this will also work, using CSS classes instead of the style directly is a better approach. If for whatever reason you need to change the font sizes in the future, you'll only have to do so in a single place (the CSS in the theme).

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.