SAVEASWORD and the Fixed Header design

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:

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:

  1. Open the Microsoft Dynamics NAV 2013 or Microsoft Dynamics NAV 2013 R2 Windows client.
  2. Go to Posted Documents (in the navigation pane).
  3. Go to Posted Sales Invoice list.
  4. Select all invoices, and then choose Print.
  5. In the report request page, choose Print and then choose Microsoft Word… and you have your repro: All the invoices belong to the first customer and have the same invoice no., etc.

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:

  • The report does not use Page Header / Page Footer


  • The report does have a Static Page Header / Page Footer

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