2

I am using SharePoint Online and have a custom list in the Modern Experience that has long titles for a few columns. With no luck I have been searching for a solution to have Word-Wraping on the title fields.

I have looked into JSON formatting and so far all of the articles talk about the data fields and not the title headers.

If this was the old SharePoint, I would write CSS in a CEWP and it would be a done deal, but this doesn't appear to be an option anymore in the Modern Experience.

Any tips or solutions to getting long title names in a custom list on SharePoint Online (Modern Experience) to do a Word-Wrap?

1

You can check the official document below, there is not a method to substring the text.

Use column formatting to customize SharePoint

As a workaround, we can use the JSON formatting below.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "style":{
        "white-space":"nowrap"
  },
  "txtContent": "@currentField"
}
2
  • Thanks for sharing this @LZ_MSFT.
    – mdevm
    Sep 23 '19 at 14:56
  • Has anyone tapped into the styles used for headers that would allow a double line? I have the "SPFx Applications Customiser CSS Injection" installed which allows me to override CSS. I know this is not recommended by Microsoft, but it is helpful as long as I realize that this could change at any time. Nov 10 '21 at 21:55
1

@LZ_MSFT Isn't that the code for NOT Wrapping column text? It looks like it is. Thus the code TO wrap column text would look like what I show below. Copy the code below and paste it in the Column Formatting text box for a column --> Click Save --> Go back to the list and hover over the column breaks --> Adjust the column width as desired --> Click dropdown arrow for that view --> Select Save view as --> Click Save

Start of JSON code is below:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "style":{
        "white-space":"wrap"
  },
  "txtContent": "@currentField"
}
2
  • Thanks for giving me a lead for this. Is this for the column headers? I tried this and didn't seem to help. Apr 8 '20 at 16:32
  • Does nothing for me, either.
    – CarlF
    Oct 23 '20 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.