Van Vugt's dynamiXs

All around NAV dev and test

The Word layout document is malformed

Last weekend I spent time to get things working on my Azure machine for the fourth week of the Junior Developer Training. A five week course I am running since last fall for Dynamics 365 Training Ltd. in the UK. While compiling the code of our example application I ran in to the following error:

"Ouch," I thought, "not again."

I had ran into this issue on my laptop a couple of months ago. At that time I was working on some label printing issue with Torben Wind Meyhoff and Niels-Henrik Sejthen, of the NAV team in Lyngby (thanx again guys for stepping in). To solve the label printing issue Torben had proposed to use a WORD layout. But ever since we had upgraded from 2009 to 2016, all our NAV developers did get this error message when compiling any report containing a WORD layout.

Niels-Henrik suggested to make sure to run windows update to see if that might fix the issue. And it did! At least ... on my laptop and our RAS development server. Unfortunately the issue continued for a couple of colleagues on their own laptop. As it wasn't a show stopping case so far we haven't paid much attention to it since then.

But last Sunday ... it hit me again. Arggggg. Super Angry And I needed to get the WORD reports working! As all updated had been installed on the Azure machine and having not a lot of to time to go and search for a solution, I decided to create a new machine to see if that would work fine.

"And of course it would have the latest NAV 2017 CU!", my mind ran.

YES, the WORD reports compiled. Again issue solved. But not for long as on Tuesday morning when wanting to run my WORD report example, the same error stopped me. Angry Hmm Sad

"No time to fix it, pal." So I left it for later, already considering to create, once again, a new Azure machine during evening hours. Nevertheless I had quick look in the Event Log, showing:

---------------------------
A call to Microsoft.Dynamics.Nav.DocumentReport.WordReportManager.MergeWordDocument failed with this message: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
---------------------------

"A corrupt DocumentFormat.OpenXml assembly?" I wondered, "Let's find out later."

That evening some more important work had to be done first, being, among others, the preparation the Data Upgrade demo for the next course day. The TableSyncSetup part ran as a charm. The real data upgrade part unfortunately didn't, and stopped with an error:

"Great, that's what I needed just now." Ick!

"The application will close?" Nope, my NAV development Environment was still running; likewise the NAVCSD Service Tier. What was happening?

Looking at the Event Log I was quite surprised to read:

---------------------------
A call to Microsoft.Dynamics.Nav.DocumentReport.WordReportManager.MergeWordDocument failed with this message: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
---------------------------

Exactly the same as with the WORD report issue.

"So solving this would in one go solve two issues," I thought out loud.

Googling around I found some reference to the Open XML SDK 2.5 for Microsoft Office, which I knew is one of the prerequisite components on the product NAV DVD: $\\Prerequisite Components\Open XML SDK 2.5 for Microsoft Office.

"Aha, lets reinstall and see."

YES, both the WORD reports compiled and the data upgrade ran without an errors! YesBeer

Maybe this post will save you the searching I had to do.

Notes

  • Apparently the new Azure machines run on Windows Server 2016. So far, as it comes to speed, the new machine I did set up last weekend, is far superior to the previous machines I used running Windows Server 2012 R2. Wow!
  • Adding the second error in text as this enables this blog post to be found in internet searches:
    ---------------------------
    The server "NAVCSD" was unable to process the request. The application will close.
    ---------------------------
  • BTW: next fall the Junior Developer Training will run again. Interested? Feel free to contact me.