Preserve line breaks in DOCX-to-PDF
PDF From DOCX smart service flattens char(10) line breaks in dynamic paragraph text. Merged output reads like one long sentence.
a!localVariables(
local!raw: ri!userInputText,
local!pieces: split(local!raw, char(10)),
local!withBreaks: joinarray(
local!pieces,
"</w:t><w:br/><w:t xml:space=""preserve"">"
),
local!docxSafe: "<w:t xml:space=""preserve"">" & local!withBreaks & "</w:t>",
local!docxSafe
)How it works
The merge engine strips raw newlines before the renderer ever sees them, so the fix is to rewrite the input as DOCX-native run XML before binding it to the placeholder. Split on char(10), wrap each fragment in a <w:t> run, and stitch them back together with <w:br/> in between. xml:space="preserve" is non-optional - Word will trim leading whitespace on every fragment without it, and the symptoms look identical to the original bug. Bind this rule output directly to the placeholder, not the raw input.