It’s relatively easy to create a nice looking Word document out of a Sales Order in Dynamics AX by using the built in Document Management feature.
The problem starts when trying to create a document with multiple order lines where some of the items have a multi line description. In this case the formatting of the lines is mixed up as shown in the following picture:
I managed to workaround this problem and was able to generate Word documents that can handle multiline fields.
Here you can see the same Sales Order created with the workaround:
=> Please note that this solution only works if the bookmarks for the order line fields are within a Word table.
Attached to this post is a zip file containing code workaround in an xpo file and including the Word template used for this example and a short description of the Document Type settings.
The zip contains xpo and templates for Microsoft Dynamics AX 2009 (valid for RTM and SP1) .
The code is provided as is with no warranties, and confers no rights, and is not supported by of Microsoft Support