NAV 5.0 Preview – Part 3 – Export to external application

Today I will try to show you one new cool feature of NAV 5.0 for end-users. NAV 5.0 is able to export any form into XML and using XSLT (template, stylesheet, transformation – you can name it in different ways) can be this XML transformed into another XML. And because MS Word and MS Excel is able to open documents defined in XML, you can create Word and Excel documents in this way (and for any other application).

How it is working

On the toolbar there are three new shortcuts, which can be used in any time when you have some form opened (Last three shortcuts on the picture, behind the watermark).

NAV 5.0 Toolbar

For example, when you open the G/L Account card, and you click on the first shortcut (Word), you will get the Word document with all data accessible on the G/L Account card.

NAV 5.0 G/L Account cardNAV 5.0 MS Word document with G/L Account card

In this Word document, there are all tabs from the form and all controls from these tabs. If you use the second shortcut (Excel), you will get slightly different result:

NAV 5.0 G/L Account exported to Excel

Each tab has own Sheet, but there are same data like in the MS Word. In both applications you can open the original NAV form through clicking on the title in exported document. It means that this document is still “linked” with the original and you don’t need to search in NAV for the original form and record.

This was example of using defualt template, which is usable for all forms. But you can attach new templates for specific NAV form and than the user can select this template for exporting within template selection form (third shortcut). In the demo DB there are templates for Customer letter (on Customer card), Contact letter (on Contact card), Vendor letter (on Vendor card) and Sales Quote (on Sales quote card) and Sales Order Confirmation (on Sales order card).

NAV 5.0 Customer letter in MS WordNAV 5.0 Sales Order confirmation in MS Word

You can see that the result can include additional data that are not part of the form in NAV (e.g. Company name, Payment terms description etc.). It means that the result can be complex and you do not need to include all data on the form just because you need to export it.

What is behind

From designer point of view is this feature very complex. Developer needs to understand XML, XSLT and target application XML. If you want to customize this feature, you have two possibilities. You can change the functions in CU1 which are used for this export (you can change how it transforms the data, which template is selected etc.), or you can modify or create own XSLT template (you can change the result of the transformation).NAV 5.0 CU1 new functions

 In the functions, when exporting some form, the XML with description of this form is passed into function which will apply the transformation from selected XSLT template, and the result is sent into the application itself. On the screenshot of the Data XML (the XML describing the form) you can see that all controls are included with some informations. From position or size is there just the width of the control (if you change width of column on the form, the excel column in exported document will have similar width)

.NAV 5.0 Form data XML

In the example there are data from Sales order card form. There is header tab control, line subform, Info panel frame etc. This XML file than can be transformed through XSLT file. Result of this transformation can look like this:

 NAV 5.0 resulting Word XML document

On the screenshot is part of the Sales quote XSLT used to transform the XML data into MS Word XML file:

NAV 5.0 Sales quote XSLT 

In the stylesheet you can include other data from NAV into the result (Object/ResponsibilityCenter/Name, Object/CompanyInfo/Name) without being part of the source XML file describing the form. I do not know more info about that (I have no access to this new codeunit yet) but if you can include any data from NAV, this will be very cool tool for creating exports. 

After you prepared some XSLT template, you can import the template into NAV through Stylesheet setup form. You need to select the xslt file, for which application the stylesheet is prepared (which app will be launched, you can add your own), the description and if the template is for all forms or just for selected (depends on which option is selected on the setup card when you run the import).

NAV 5.0 Stylesheet setup formNAV 5.0 Stylesheet setup form

One bigges issue I have with that is, that I am not able to find any user-frendly tool for creating the stylesheet in some visual way (I am novice in XSLT and XML things…). And second thing is that the logo bitmap is part of the stylesheet and it means that you need to customize the stylesheet for each customer. And because I have no good tool  for XSLT, I do not know how I can replace the bitmap in the stylesheet…

 I hope that after documentation for NAV 5.0 is released, I will have more info to be able to create own stylesheet and to work with that like with C/AL and that customization of XSLT will be easy for me.


I do not know what will be in next part now.

 All screenshots you can find in fullsize in my library at

20 thoughts on “NAV 5.0 Preview – Part 3 – Export to external application”

  1. 1) You do not need to create report or something like that when you want to export some data into Excel
    2) You do not need to use merge to insert data into Word
    3) You do not need to use atuomations to work with Word and Excel
    4) You (I mean partner) “just” need to create correct XSLT for anything the customer want to create in any application able to open XML file.
    5)it means that you do not need any change in C/AL code to do the export, you can use whole set of attributes and properties of the aplication etc.

    Many customers requests possibility to export this and this into excel, possibility to create Letter for customer on click…

  2. Ad1)
    To export a tabular form? Currently you will get the same result with copy’n paste.
    To export a card form? I think I’ll still prefer to use zoom and then use copy’n paste. I would rarely have fields in Excel with NAV columns and layout.

    To get any decent Word document you will need a dedicated stylesheet for the form.

    Agree, but isn’t Office Automation easier than working with stylesheets in Notepad? 😉

    Until there is some great mapping tool (like BizTalk) I still think C/AL is easier.

    Don’t quite understand. Example?

    Yes, but without a GUI tool I don’t see how it will be any easier.

  3. ad 1) Tabular form, but with some aditional data. Of course that Copy&Paste is the quickest way.

    Export of all data on card form can be useful for example for reporting some issue to developer. You just click to export the form into excel, attach the excel to mail, describe the action and it is done. You do not need to take screenshots of the form to report the values you used etc.

    ad 2) Yes, you need to create stylesheet for the form, from which you want to have it accessible.

    ad 3) Not in case when the code is running on service tier and it means that the automation is used on the server (with service tier) and not on user PC. Another thing is using applications which have no automation interface (for example you can use it to create document for OpenOffice ;-))

    ad 4) I fully agree, this is a big pain and I am waiting for some good application to be able to create the XSLT in some visual way

    ad 5) With automation you are limited with the automation interface. With XSLT sheet you can generate any attribute which exists in the target XML schema. It means that you can generate (create) anything what can be saved in the XML. I know that most of the things there is automation function to set it, but may be that for someone and somewhen will be much easier to change the XSLT than change the C/AL code.

    My opinion is that this functionality is there to have same possibility to export data as in SAP B1. And yes, without good tool it is too hard to use it. With good tool, it will be good feature. And it is good for salesmans for the wow effect when they show this to new customer… 🙂

    (PS: your post was not publiced immediately because it scores in SPAM filter)

  4. Spam filter? Really? How embarrassing 🙁
    Ad 1) Ok – so without customized stylesheets it is mainly for troubleshooting.
    Ad 3) Ohhh s**t! Haven’t thought of that! So you are saying that with the new 3-tier client will any automation code use the automation on the server and not on the client? Can’t quite figure out all consequence of that, but it will surely surprise quite a few. 🙂 Wonder how files are handled in the 3-tier client. Will paths be based on the server or client? I guess the new functions to up- and download indicates it will be based on the server.
    Ad 5) I have created a lot of different xml-files from NAV, so it will take quite some time before it will be easier to make a stylesheet 🙂

    Great work you are doing – really looking forward to get the new version myself.

  5. ad 3) I am not sure but I hope that there will be somepossibility to set where the atuomation will be running. But I have no informations about that right now. About the files – In my opinion if you use just Create or Open, the path will be local. When you will need to transfer the file to client PC, you will need to use UPLOAD or DOWNLOAD.

  6. Hmmmm,

    I can’t run (never mind design) codeunit 403 with my normal licence, and the Cronus licence tells me I have unknown OLE objects.

    Total pain in the arse.

  7. Yes, because you need fresh license file. This codeunit is new and you have no permissions in your pre 5.0 license. You need to use the Cronus (Contoso) license file for that.

    I do not understand the “nd the Cronus licence tells me I have unknown OLE objects.”. When? Exact text? I have no problems with that. Are you trying on VPC or you downloaded the install files and installed it from there?

  8. I downloaded the install files, not the VPC.

    When I click on the Word icon for example, Navision says something like:

    This message is for C/AL programmers:

    Could not create an instance of the OLE control or Automation server identified by GUID={F5078F18-C551-11D3-89B9-0000F81FE221} 6.0:{88D96A05-F192-11D4-A65F-0040963251E5}:Unknown Automation Server.Unknown Class. Check that the OLE control or Automation server is correctly installed and registered.

    Well, I would, but don’t have a clue which one it is.

    Do I need Office 2007 to get this working?

  9. I did a google search on user friendly style sheets. There is a company called Altova – with a web site by the same name – that offers a product called Stylevision that claims to provide this. It has a 30 day free evaluation. I don’t have time to check it out myself, but it might be worth checking out to see if it will help with Navision.

  10. I tried it, but it is just good editor for the stylesheet, but you need to do everything manually. I can imagine some editor, where I can see the source, the stylesheet and the resulting document…

  11. Same here… Existing Stylesheets work, and also I get out the way for replacing the standard-cronus logo with another one. But I don’t know how to finish larger changes in exisiting Stylesheets. Not at all I can imagine how to create an absolute new stylesheet for a diffrent issue.

    A graphical xslt-editor is needed =/

  12. It’s great to see you blogging on NAV 5.0 and the new features. I’ve not seen any posts for a while but you have been an inspiration for me to try and write about my experiences with Dynamics NAV 5.0.

    I was looking at the click-through demo for Dynamics NAV 5.1 (the new role-based user interface) and I was intrigued to see that the generation of a order confirmation looked to be using the same XSLT transformation into a word document as we have seen in NAV 5.0. I have no idea if there is going to be a tool to help you produce this, but I seriously doubt it. I am going to try and cover how to create an XSLT from scratch using Word and some knowledge of WordML on my Blog Hopefully I’ll get some more time to play around with this but in the meantime – keep up the good work!

  13. Thank you for the helpful article about this new functionality in Nav 5.0. It is quite helpful to get in this stuff.

    Can you tell me how did you get the Data XML on your screenshot (the picture before “Result of this transformation can look like this”). I didn’t find a possibility to get a look at the xml data before it is transformed by the stylesheet. Thanks in Advance.

  14. If you look into CU1, function LaunchApp, both XML are passed as parameters. I just added code which saves this XML into file… 😉

  15. Hi Kine,

    You would help me a lot if you could post your code to save the XML as you mentionedin your comment om June 19, 2007 11:12.
    I’m trying to figure this out but i’m stuck.

  16. and did you by any change have been working for a solution to create Worddocuments in batch?
    I you have to create a new DataXml-xml to pass on to cdu 1, that’s a lot of work.

Leave a Reply

Your email address will not be published. Required fields are marked *