XML Printer solution provides an alternative way to generate Microsoft Dynamics AX (Axapta) reports in Microsoft Word format.
XML is a standard technology for data exchange between various platforms and applications. General idea of XML Printer is to generate XML files based on data sources used in Microsoft Dynamics AX (Axapta) reports. Automatically generated XML files can be used as data sources for Microsoft Word templates that allow utilizing XML Printer together with predefined Microsoft Word templates and getting Microsoft Word document from Microsoft Dynamics AX (Axapta) report as final result.
XML Printer functionality includes 2 main parts:
XML Printer works as usual Microsoft Dynamics AX (Axapta) printer. E.g. it is necessary to redirect output of Microsoft Dynamics AX (Axapta) report into XML Printer. As a result, XML file with all data used in report will be generated. Using button “Printer setup” in posting routine (like Quotation / PackingSlip / Invoice posting) or button “Options” in report dialog, it is necessary to select XML Printer and specify a file name for newly generated XML file, as shown in Figure 1.
This step can be skipped if XSD schema (see chapter 4.2) is created manually.
Using XML Schema Definition tool (XSD.exe) from Microsoft .NET Framework tools, it is possible to generate XML schema that can be used to create Microsoft Word template.
Microsoft Word template with references to XSD elements is to be created at this step. As a template is created in Microsoft Word, it allows keeping maximum formatting features in final document.
Using “Tools => Templates and Add-Ins” menu of Microsoft Word 2003, tab “XML Schema => Add Schema”, it is necessary to link XSD schema created in par. 4.2 with Microsoft Word template, as shown in Figure 2.
After XSD schema has been attached, it is possible to insert XML elements in Microsoft Word template, as shown in Figure 3.
When final document is generated, these XML elements are replaced by real data from Microsoft Dynamics AX (Axapta) report.
Using Microsoft Office Word 2003 XSLT Inference Tool, it is necessary to create XSL transformation from previously created Microsoft Word template. XSL transformation helps to transform XML files into documents with complex and rich formatting quickly.
To get XSL transformation file, the following steps are necessary:
As a result, XSL transformation “quotationreport.xsl” is created.
At this step, it is expected that template in XSL transformation format exists in \Appl\Standard\WordTemplates folder. The value of report property “Caption” is used to link XML file with report data and XSL template. E.g. if we output report “SalesQuotation” to XML Printer, it is necessary to store XSL template as “\Appl\Standard\WordTemplates\QuotationReport.xsl”. In this case, generated unicode XML file “Appl\Standard\WordReports\_quotation.xml” will be opened in Microsoft Word and automatically transformed into Microsoft Word document according to XSL transformation file.
XML Printer allows generating Microsoft Dynamics AX (Axapta) reports in Microsoft Word format without additional programming. It keeps maximum formatting features in final document, providing the output with high performance.