Forum Discussion
Sharepoint list how to wrap text in gallery view
please try removing the below line:
"class": "ms-fontColor-neutralPrimary sp-card-content sp-card-highlightedContent"
uttam27 thanks for the hint - Unfortunately all this does, is to take the bold typeface from the header, where this "class" attribute is set.
As a reference, here's the relevant <div> from my JSON formatting - The incorrect breaks are happening in the "Beschreibung".
{
"elmType": "div",
"attributes": {
"class": "sp-card-displayColumnContainer"
},
"children": [
{
"elmType": "p",
"attributes": {
"class": "ms-fontColor-neutralSecondary sp-card-label"
},
"txtContent": "Projekt:"
},
{
"elmType": "p",
"style": {
"text-align": "justify",
"height": "150px",
"white-space": "break-word"
},
"attributes": {
"title": "[$Beschreibung]",
"class": "ms-fontColor-neutralPrimary "
},
"txtContent": "=if ([$Beschreibung] == '', '–', [$Beschreibung])"
}
]
}
- uttam27Aug 22, 2022Copper Contributor
Please try changing the line 19 from:
"white-space": "break-word"to:
"word-break": "keep-all"My apologies, I am also not expert in this, but this is something I found that helped me recently.
- Ronald_DartschMar 03, 2023Copper ContributorAwesome, thank you!
- TammyVonglisSep 28, 2022Copper Contributor
uttam27 Can you give me the for dummies? Where do I insert this JSON? Thank you!!!
- ganeshsanapSep 29, 2022MVP
TammyVonglis For gallery view, you have to use the View formatting option in list and add your JSON code in gallery/tile view JSON in advanced mode.
Follow this Microsoft official documentation for more information: Gallery layout customization
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- SourceressSep 26, 2022Iron ContributorBrilliant - this helped me too with something similar 🙂 Many thanks!