I have some record details that are losing spacing, and line breaks, when bringing them into design. I need to have those lines retained for proper spacing on the sheet. I can’t do this by stylesheet or script suffix as some data will have spaces, and some will not. Notice in the snips, that ther is spacing before Shipped, Sold, and between Packaging and Unload that isn’t being brought over. Also, there are spaces between every line of the “Please Deliver before 8 AM” block of text. Which show up in the data model.
It looks like you’re using a PDF as your data source, is that correct?
The datamapper source is a text file. I am creating a PDF with Connect Design.
The second picture is of design an how it is laying the text on the page.
Ok, I think I understand now.
HTML doesn’t like spaces very much and will not display excess spaces in a string.
To get around this, you can replace those spaces with
Probably the easiest place for this would be in your Text Script. Perhaps something like this:
var field, result = “”;
field = record.fields[“Field1”];
if (field !== “”) result += field.replace(/ /g, ‘\u00a0’);
results.html(result);
Above, it does a global search for a standard space and replaces it with a non-breaking space.
Alternatively, you should be able to apply this CSS to prevent the HTML from collapsing the spaces.
@Field1@
Great! Thanks for the quick help!!
My pleasure, happy coding