cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Przemyslaw
Frequent Visitor

multiline label and ellipsis("...") when text does not fit, wrap property

Hi, 

when I have a label which is not big enough to store the text then I can setup my label to put ellipsis ("...") at the end of the text automatically. This can be done with settings:

label.wrap = Off

label.autoHeight=Off

 

 

So when I have very long piece of text  (e.g. "very long text. Very long text"). it just shows, e.g. : 

Very long t...

What I want to achieve is to have the same behavior but for multiple lines (e.g. 2 lines) of text.

I created label which is 3 times as height and I put the same settings (label2.wrap = Off  label2.autoHeight=Off)

Unfortunately this does not work and only single line of text is being displayed (ended with ellipsis). 

 

 

 

labelWrap.png

Does anyone know how this can be achieved?

 

 

 

 

5 REPLIES 5
mdevaney
Super User
Super User

@Przemyslaw 
A canvas-apps component that will solve your issue is available for FREE on the community gallery.   In fact, Emmanuel Gallis (aka R3dkap) has a bunch of awesome components there worth checking-out 🙂

 

Link to component:

https://powerusers.microsoft.com/t5/Canvas-Apps-Components-Samples/Auto-Width-Label-Generator/td-p/5...

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

hi @mdevaney 

thanks for this, it is interesting and potentially it might help creating working solution, but I am afraid a lot of effort would be required. Problem with multiple lines is that you never know how powerapp will divide the sentence into multiple lines. Usually powerapp is trying to not divide words if possible, unless your label is very narrow. It would be a lot of hassle to divide the sentence programatically into lines (by adding line feed into the string) to have full control over it and then to add "..." at the very end. 

I was hoping there is some easier way of doing this, maybe someone else might help here? Thanks for your suggestion.

Anonymous
Not applicable

If(Len(ThisItem.Arm_Sl_Name) >= 70; Replace(ThisItem.Arm_Sl_Name; 70; Len(ThisItem.Arm_Sl_Name)-69; "..."); ThisItem.Arm_Sl_Name)

This formula in labels works, you only show the number of chars you want and then  the "...".
The "70" you have to change for the number you want, depending on the width.
Hope it helps


gbux
Advocate I
Advocate I

Hi. I solved this for using the following
If(Len(ThisItem.Title)>45, Concatenate(Left(ThisItem.Title,45),"..."),ThisItem.Title)

Assuming the field is called ThisItem.Title and the length limit is 45 characters

kristinegriba
Advocate I
Advocate I

@gbux I tried this and it worked awesome... great idea, too! Thanks!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,419)