3

Just wondering how to create a list with line breaks in a calculated column without using data view.

1

social.technet.microsoft.com suggests that this can be achieved with " Shift + Enter "

Worth a try?

Steve

  • This works for sure inside =CONCATENATE() – 121315 Jul 6 '12 at 12:42
1

I suppose it depends on what you want the business rules to be around where the line breaks should appear and in how many places (all pages, just a single view, just on the forms, etc.). You could probably do this with script added to the page(s).

1

I've had a play around and I'm afraid I can't see a way to do this. The only two options I can think of are:

=CONCATENATE("A","
","B")

Which outputs A B because actual new lines are ignored by the HTML rendering.

or

=CONCATENATE("A","<br/>","B")

Which outputs A<br/>B because HTML output is escaped by SharePoint.

1

You could use <br/> in your column to indicate a line break. Then, add a script to your page to insert that text as html so that <br/> becomes an html line break.

<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script language="javascript" type="text/javascript">
  function insertLineBreaks() {
    $("table.ms-listviewtable").find("td.ms-vb2").filter(":contains(<br/>)").each(
      function(){
        $(this).html('<div>'+$(this).text()+'</div>');
      });   
  }
  _spBodyOnLoadFunctionNames.push("insertLineBreaks");
</script>
  • This looks like a solution! Can the script be inside a content editor web part or does it have to be located in the main page html? – 121315 Jul 25 '11 at 16:25
  • You should be able to put it in a Content Editor web part. – Laurie Jul 25 '11 at 16:36
  • @Laurie - code works great until you set up the view to group your line items. Then it breaks and shows "<br/>" again. How do you get around the grouping so the code can access the list items again? – user31626 Jul 16 '14 at 21:48
  • Is this solution taken from sites.google.com/site/sharepointhill/tutorials/mssp/… ? – George Feb 5 '15 at 3:55
1

Use Char(10) as a line break character.

0

Include <br/> and return the calculated column as a number instead of a single line of text. For some reason, this returns html.

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.