-3

We have a field under .csv file and that field contain two paragraphs showing in one row :

orem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. 

It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

When we are try to insert this data from Sitecore powershell script then it does not add space between two paragraph in Rich text box.

Adding code in powershell script

$item.Editing.BeginEdit()            
  $item["Description"] = $row.'Description'
  $item.Editing.EndEdit()
2

You text contains multiple lines, but it doesn't matter when html is being rendered.

What you need to do is either wrap every single line into a separate paragraph (<p>) or replace new lines with <br> tags.

Here is sample code for the latter:

  $item["Description"] = ($row.'Description' -replace "`r`n", '<br>') -replace "`n", '<br>'

I don't know if it's both CR + LF characters or just LF so I wrote a code which should take care of both situations ( https://developer.mozilla.org/en-US/docs/Glossary/CRLF ).

If you want to wrap your text in paragraphs, you need to add <p> before and </p> after your string and replace every line ending with </p><p> (assuming that your input is not html code already).

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.