Developer forum

Forum » Integration » Keep line breaks in text fields on import

Keep line breaks in text fields on import

Martin Moen
Reply

We have a problem where line breaks from rich text fields in NAV are not kept when the integration task is executed.

Please have a look at the two attached screenshots. The line breaks are correct in the XML-file from NAV, but they are ignored when the integration job is finished.

How can we keep the line breaks?!

Screenshot_2022-04-13_184032.jpg Screenshot_2022-04-13_184059.jpg

Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Martin,

In your example the bullet list is not formatted as HTML (<ul> <li> ...) and line breaks are usually ignored unless you use the line break element (<br>), preformatted text element (<pre>) or split the content into flow elements (<div>, <p>, etc.).
The value of the "ProductIngress" column currently contains a mix of HTML and plain text. Is this how the values are actually stored in NAV or did you combine multiple values from NAV into the "ProductIngress" column?

Try to see if you can get proper HTML out of NAV - and avoid combining values of different types (plain text and rich text).

Best regards,
Morten

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

If you have no control over the data then you can try "fix it" by either wrapping it in preformatted text element (<pre>) or use CSS (e.g. white-space:pre).

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre

https://developer.mozilla.org/en-US/docs/Web/CSS/white-space

But it might not work as expected in all cases.

 

Votes for this answer: 1
 
Martin Moen
Reply

Thanks Morten. This is how we get it from NAV. They store the data like this in a blob field I think, and usually there are no HTML, except when there are embedded video like her.
We will try to hack it like you suggest for now, and then ask the customer to stop using NAV as a visual text editor :)

 

You must be logged in to post in the forum