1

I am provisioning a list declaratively in Visual Studio. In the schema for the list I want to include a field that has multiple lines of text for its description.

Currently I have this in the schema.xml:

<Field Name="Priority1" ID="{dbae015b-a469-4667-b443-c8753366de26}" DisplayName="Priority" Type="Choice" Description="Low: low text\nMedium: medium text\nHigh: high text">

Which results in this in list forms under the Priority field:

Low: low text\nMedium: medium text\nHigh: high text

But I want this:

Low: low text
Medium: medium text
High: high text

Also tried the BR HTML tag but apparently this is not allowed in the schema XML.

3 Answers 3

5

I ran into the same issue recently and found that you need to use '&#xD;&#xA;' (HTML-encoded carriage return + line feed) for newlines in the description field. This will result in SharePoint rendering a <br> tag in the browser.

2
  • 1
    In 2013 You can press Enter in Field settings "Description" and it becomes <br>
    – Gennady G
    Sep 29, 2016 at 20:19
  • @GennadyG Using the Enter also works for SharePoint Online.
    – Abbas
    Sep 10, 2018 at 9:54
0

it does not seem to work in modern SharePoint Online lists/columns anymore.

You can add line breaks, but it will not show up anymore later when rendered below the actual field, then all line breaks are removed.

You could update the CSS of the page / description fields with "white-space: pre-line;", then the line breaks that you added before in the editor will show up again, but by default, in the edit forms, they are not rendered. :(

.. or you could switch back to classic mode, there, line breaks in column descriptions also show up again.

See also https://answers.microsoft.com/en-us/msoffice/forum/all/how-to-put-a-line-break-in-a-description-of-a/d2f910e9-39ed-481e-a8dc-29c287a97d78

Setting the encoded line breaks in the description on field creation in SchemaXml might work, my problem was to set them afterwards. Unfortunately, it seems not possible to "set-npnfield" the value of a column description of a column in the same way, the ampersand will get escaped then. So you should probably rather store the description string with a real line break in powershell.

0

I got results from inserting a heading with a non-breaking space:

# &nbsp;
  • or - inserting two consecutive non-breaking spaces separated from the preceding & following text by an empty line:
This is text

&nbsp;&nbsp;

More text

Oddly enough, inserting an H4 gave more space than an H1, H2, or H3:

#### &nbsp;

What didn't work:

<br>
<br/>
\u000a
'&#xD;&#xA;' (HTML-encoded carriage return + line feed)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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