web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Height of a datacard
Power Apps
Answered

Height of a datacard

(0) ShareShare
ReportReport
Posted on by

Hi, I have an app sourced from an Excel file on OneDrive. One of the datacards has much more text than the others. I've had to turn Auto height off, as Auto height seems to have a limit that cuts out a lot of the text. Therefore, I've given the datacard a height that is equal to the biggest text feild. The problem now is that the quantity of text for that datacard varies quite a lot, so some searches have an empty white area before the next datacard. Is there any Height code I can use - or any other solution? Thanks!

Categories:
I have the same question (0)
  • Verified answer
    dinusc Profile Picture
    Microsoft Employee on at

    I can't think of another straightforward way of making the field or card size adjustable to the text content. 

    Instead of setting the card size to accomodate the largest text, can you try making the corresponding card field scrollable (Overflow = Scroll)? This would allow having smaller cards.

  • Community Power Platform Member Profile Picture
    on at

    This worked - and it also improved the functionality and design of my app in the process! Many thanks! 

  • kbarber Profile Picture
    162 on at

    Hello Dinusc,

    I created a simple SharePoint Form from a custom list and am struggling to adjust the datacard height values - they seem to have a limit set on their height property, and the minimum height allowed is still too tall! I looked for a way to implement your recommended solution (Overflow=Scrollable) but I can't seem to find said property?  Am I missing something?  Where can I set the "Overflow"?

    Thanks!

  • dinusc Profile Picture
    Microsoft Employee on at

    Hi Kbarber,

     

    My suggestion was to set the overflow on the label inside the card. This is to ensure that any content can be displayed in the label field that is a part of fixed-size data card.

    Capture.PNG

  • kbarber Profile Picture
    162 on at


    Thanks for the clarification @dinusc. While helpful in its own right, I don't think it will address my issue.  Here is a link to my post in case you're interested in getting more details:

    https://powerusers.microsoft.com/t5/General-Discussion/Height-of-datacards-in-SP-List-Custom-Form/m-p/77363#M30638

  • SJacobs Profile Picture
    71 on at

    Here's how I resolved this issue:

     

    1) Card is only one in its row and WidthFit = True

    2) Set Card Height to 0

    3) In the data card Text Input control, enter formula for height:

               30 + ((RoundUp(Len(Parent.Default)/100,0) -1) *20)

     

    This will effectively give me the AutoHeight feature i was looking for.

     

    Explanation of the formula:   30 +((RoundUp(Len(Parent.Default)/100,0) -1) *20)

    30 = minimum height

    100 = characters per row

    20 = height per row

  • kbarber Profile Picture
    162 on at

    thanks @SJacobs - I'll give this a try soon - seems to be quite a clever workaround

  • SJacobs Profile Picture
    71 on at

    I have had to modify that formula to address the possiblity of null values and linefeed characters within the text.   Blank values are handled by adding 15 if IsBlank returns true.  Linefeed characters is more of a problem.  I searched for Char(10) and added 20 to height if found, but that only works if there is a single linefeed.  I do not know how to count the number of linefeeds within a string.

     

    Here's my current version of the formula for height.

     

    35 + ((RoundUp(Len(Parent.Default)/100,0) -1) *20) +If(Find(Char(10),Parent.Default)>0,20,0) + If(IsBlank(Parent.Default),15,0)

     

    Note: I'm using OpenSans size 13 font. Line Height is set to 1.2

  • nickduxfield Profile Picture
    497 on at

    I had a situation where I was trying to mimic an editable PDF. I had HTMLText for the DataCardKey's to present nice formatted Questions. No matter how meticulus I was witht he HTML the auto height would fail on one of the many fileds. 

    What I did was a bit interesting.

    I have a Large list with all the formatted HTML questions in a sharepoint list. 

    Title, Body, Height, Part

    Body is the HTML, Part is the PartNumber, Height is how big I want the KEY size.

    I used simple lookups to pull the correct height for each DataCard. Its a static approach but its solid and the questions wont change once setup. Because the Columns were names Part1,Part2,Part3... I was able to hookup Lookups that refer to the DataField name "Part1". Because of this the same Code applied across all Datacards.

     

    Auto height sometimes wont workout esp in HTML text controls.

  • ching29 Profile Picture
    9 on at

    This might be a bit late but I hope this still helps to other who is facing the same dilemma.

     

    This is how I managed to count the line feed.

     

    Len(Parent.Default)-Len(Substitute(Parent.Default,Char(10),""))+1

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard