May 21 2021 09:36 AM
May 21 2021 10:09 AM
@Dc111222 You are right. You have to customize the card designer JSON for gallery view & add style to the element where you want to wrap the text.
You can use the styles like word-wrap in JSON. Full list of supported styles is given at: SharePoint JSON Formatting - style
You can find detailed step about how to customize the card design JSON for gallery view in below post:
Change the width of a card in Gallery view of a List
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.
May 28 2021 12:39 PM
I inadvertently posted this question on another board. I'm not a programmer and just getting introduced to JSON via my duties in SharePoint. I can get the following to work on Kudos field via column formatting. I can see this in list view. How do I get same word wrap formatting added to gallery tile view JSON? When I add the following to JSON in gallery view, the text field disappears. Kudos is single line text field. I'll be able to adjust the tile height/width but stuck on word wrap. Thank you in advance.
{"elmType": "div", "style":{ "white-space":"wrap" }, "txtContent": "@Kudos" }
Where does the above json go in gallery view JSON below?
{
"elmType": "div",
"attributes": {
"class": "sp-card-displayColumnContainer"
},
"children": [
{
"elmType": "p",
"attributes": {
"class": "ms-fontColor-neutralSecondary sp-card-label"
},
"txtContent": "[!Kudos.DisplayName]"
},
{
"elmType": "p",
"attributes": {
"title": "[$Kudos]",
"class": "ms-fontColor-neutralPrimary sp-card-content sp-card-highlightedContent"
},
"txtContent": "=if ([$Kudos] == '', '–', [$Kudos])"
}
]
}
May 30 2021 10:41 PM
@JeffThiel Try using below JSON:
{
"elmType": "div",
"attributes": {
"class": "sp-card-displayColumnContainer"
},
"children": [
{
"elmType": "p",
"attributes": {
"class": "ms-fontColor-neutralSecondary sp-card-label"
},
"txtContent": "[!Kudos.DisplayName]"
},
{
"elmType": "p",
"attributes": {
"title": "[$Kudos]",
"class": "ms-fontColor-neutralPrimary sp-card-content sp-card-highlightedContent"
},
"txtContent": "=if ([$Kudos] == '', '–', [$Kudos])",
"style": {
"white-space": "wrap"
}
}
]
}
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.
Jun 01 2021 05:21 AM
@ganeshsanap Thank you very much for your reply. Unfortunately, I'm unable to get the text in field to wrap in gallery view. JSON below directly from gallery view... I can see word wrap in list field but not when in gallery view. Afraid i'm missing something simple here. Even if I increase height/width of card Kudos text field does not wrap. Please help when you get a moment. And thank you.
Apr 21 2022 01:59 AM
@JeffThiel Have you ever gotten this to work? I'm stuck at the same thing here.
Apr 21 2022 03:42 AM
No, unfortunately I did not.
Apr 25 2022 12:37 AM
Hi,
Would you be so kind and help us out here? Neither for myself, nor for your input worked as expected.
Aug 19 2022 12:26 PM
please try removing the below line:
"class": "ms-fontColor-neutralPrimary sp-card-content sp-card-highlightedContent"
Aug 21 2022 11:42 PM
@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])"
}
]
}
Aug 22 2022 01:00 AM
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.
Aug 22 2022 01:10 AM
Sep 26 2022 04:37 PM
Sep 28 2022 11:04 AM
@uttam27 Can you give me the for dummies? Where do I insert this JSON? Thank you!!!
Sep 28 2022 11:20 AM
Sep 28 2022 10:16 PM
@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.