In this blog I will focus on the Microsoft Dynamics Ax 2012 document generation. How can we use the DocX dll.
The first thing is the installation of the DLL. The DocX dll should be placed in the client / bin and server / bin folder. You can take the code from Codeplex from here.
When this is done the reference can be imported.
After the installation you defined a small template. In this template there is a header, 2 fields to replace. It is of course also supported to use custom properties from Microsoft Word and fill those during the document generation.
Via code you can add a table with 5 columns using a table design and add some text to the header columns. The code in Microsoft Dynamics Ax is pretty simple and is way easier to understand than the standard API. When you read the code you can see how we can use the arrays in ax 2012.
When this job is executed it will take the template as a base and add a paragraph to it with a fixed text. After that it will create a table with 2 rows. The document is closed with another fixed payment text.
At the end the document is saved and ready to open.
No comments:
Post a Comment