Microsoft Dynamics NAV 2013 and Microsoft Dynamics NAV 2013 R2 implement a new rendering extension and give users the capability of saving the report into Word .DOC (NAV 2013) or .DOCX (NAV 2013 R2) format. The same action can be done through C/SIDE by using the SAVEASWORD C/AL statement. For more information, see the MSDN Library: http://msdn.microsoft.com/en-us/library/hh165802(v=nav.71).aspx
However, the Report Viewer Word rendering engine has some caveats related to its own proper design that you should be aware of.
When you are invoking the Word rendering engine, the Header and Footer are transformed into static Word Header and static Word Footer. The SSRS team took the basic Header / Footer Word concept to have these as static sections. Therefore the FIRST statement generated in report viewer is the one that will be sent to the Word document, no further processing will be made typically to the value expression of any control in Page Header / Page Footer. In other words, it is like saying that all the ReportItems!Field.value or Code.Function() in Page Header or Page Footer are evaluated only one time and never changed at runtime.
Let's illustrate the challenge with the Word rendering engine and how it handles Page Header and Page Footer within the context of Microsoft Dynamics NAV. I am using the following to demonstrate this behavior in few seconds:
This designed limitation is described in the Page Headers and Footers section of the Exporting to Microsoft Word (Report Builder and SSRS) article in the TechNet Library:
The article points this out: "However, when a page footer or page header contains a complex expression that evaluates to different values on different pages of a report, the same value might display on all report pages. "
Since this is a declared design limitation, you could target SAVEASWORD to those reports where:
If you would like to have this design changed in future version from SQL Server Reporting Service (SSRS) Team, I would encourage you to log a request of design change into MSCONNECT or vote for an existing one, if any.
These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.
Duilio Tacconi (dtacconi)
Microsoft Dynamics Italy
Microsoft Customer Service and Support (CSS) EMEA
A special thanks to Peter Borring Sørensen & Torben Wind Meyhoff from the Microsoft Dynamics NAV Core Team