Labels

Thursday, March 29, 2012

Converting docx file to stylesheet


From NAV version 5.0 here's the possibility to send forms to Word/Excel. This functionality uses progressive XSLT technology, which uses source XML file with data + XSLT file with view template.
There is special tool to make the process of using templates much easier. See http://www.mibuso.com/dlinfo.asp?FileID=869 for additional info. But unfortunately this don't works for me. 
I prefer to investigate the manual creation of XSLT from source DOCX file. It's very important to use Word 2007 - 2010 and DOCX extension, because it's represents by XML file.
1. Firstly we should do the "bookmarks" in source text, where we want to export some values, e.g. fldVIN in the location, where's VIN should be.
2. Save DOCX file. Change the extension to ZIP. Inside archive find the file document.xml and copy it to initial folder.
3. Open the document.xml in notepad editor and replace text at the start of file (from the beggining to the tag <w:body>):