Has anyone had success having multi-line fields displayed properly on a Word report in NAV 2015 ?
For the Word content control (plain text type), I have set the "Allow carriage returns (multiple paragraphs)" checkbox, and it does make the difference in the way that pressing Enter inside the content control results in a linebreak, while for the controls without that checkbox, pressing Enter is suppressed and does nothing. Hence, not the Word's fault.
Meanwhile from NAV, I've tried about everything with no success, e.g. the one below outputs a single-liner in Word, CRLF ignored:
CRLF[1] := 13;
CRLF[2] := 10;
TextField := Description + CRLF + "Description 2";
Also tried to directly output a NAV text field with MultiLine=Yes with some linebreaks, same result.
Any suggestions? If nothing else, where do we report such issues to MS currently? Connect?
[ currently using CU 5, nothing related to be seen in platform fixes in later builds ].
Comments
Essentially I'm placing '{CRLF}' markers where I wish the newlines to appear in Word, and customize standard codeunit to convert those to linebreaks after NAVWordXMLMerger has done its job.
Messing with .docx directly, any guarantees disclaimed.
In Codeunit 9651 Document Report Mgt.:
The function itself:
PS. Still looking forward to hear the normal way of doing this
Thanks for this - have found it useful!
However, have found one small problem - if you use this technique and the data is in a Header section it does not work.
In addition to document.xml, you should also convert the header1.xml (header2.xml, ...) and footer1.xml files.
Standard Word custom xml parts can be used instead of the NAV WordMergeDocument AddIn. Then a CL/LF is correctly transformed into a line feed within a plain text content control.
(see https://massivedynamicsblog.wordpress.com/2016/09/08/wordlayout-revisited/, e. g.)