Tuesday, January 31, 2012

Word Templates rendering report in Internet Explorer

I have been working on a Word Templates case for the past 2 weeks and just got to the bottom of the problem, hence I felt the need to pause and blog about it.


A client of mine reported a couple weeks aback that they had created a template version of their purchase order and each time the purchasing staff attempted to print a purchase order, the output would automatically generate in Internet Explorer instead of Microsoft Word. As the title of this article suggests, the client is using Word Templates to generate a nice looking PO for their vendors.

HTML POP Purchase Order Blank Form

However, and to make matters more interesting, when they printed a standard sales invoice, SOP Blank Invoice Form, these would generate just fine in Microsoft Word.


In troubleshooting this process, we went through all the formal setup and steps to create a template in Microsoft Dynamics GP, with the added benefit that the client's purchase order form was not a modified report. I also outruled the Word Add-On for Microsoft Dynamics GP being an issue, since the sales invoices were being created just fine.

I made sure the client was not accidentally selecting HTML as the default output. As previously mentioned, when the purchase order was printed, it would automatically go to Internet Explorer. We also selected a File output and the Microsoft Word file would automatically get an html extension following the docx; for example, POP Purchase Order Blank Form.docx.html.

Printing Purchase Order Document
When printing the purchase order, one thing stood out in the printing process... the Report Type drop-down list would automatically default to Standard -- not to Template as would be expected -- and the client would have to manually select Template before clicking Ok to print. Not so, when printing sales invoices.

We also checked the REPORTS.DIC dictionary file, by accessing Report Writer, to ensure the purchase order report was not modified. Effectively, this was not the case. Puzzled by this situation, I called my good friend Rob Wagner over at Microsoft and explained what was going on. In formulating an approach to address the issue, Rob added a key to the Dex.ini - more on this tomorrow - that would allow him to debug what was happening when the template was generated.

To Rob's surprise, adding the Dex.ini key had no effect nor did it produce the debug file he was expecting. Then, the magical question came up... "Does you client have any third party products or add-ons installed that affect the POP module?" and the answer... "Yes, Project Accounting". This is when it all became clear to both of us where this was going.

As it turned out, the client is also using Project Accounting. However, the user entering the POs has no access to the Purchase Order Entry alternate window - hence was seeing the standard Microsoft Dynamics GP Purchase Order Entry window. However, according to security settings, the user had access to the alternate POP Purchase Order Blank Form report.

Access to alternate version of POP Purchase Order Blank Form

When the user prints the PO from the standard Purchase Order Entry window, GP would attempt to print the Project Accounting alternate purchase order report, but could not find a corresponding template.

Rob proceeded to explain that this behavior was by design. In essence, when a template cannot be found for an alternate version of an original Microsoft Dynamics GP report, the Dexterity code behind the Word Template functionality, will automatically render the report to HTML. Since html files are usually tied to Internet Explorer, this would cause that application to launch automatically.

The first tell-tell sign of a problem as described above lies in the Report Destination window defaulting the Report Type drop-down list to Standard, even though a template "exists" for the report being printed. In reality, the template you are seeing in Report Template Maintenance is the core Microsoft Dynamics GP report template and not the template for the alternate dictionary, in this case Project Accounting.


If using a third party product or add-on that contains an alternate versions of a core Microsoft Dynamics GP report, you will need to ensure that the template that is created corresponds to that dictionary or remove security to the alternate report.

However, and as luck would have it, I could not create a new template based on the existing POP Purchase Order Blank Form in the Microsoft Dynamics GP dictionary, because the two reports use a slighly different data set - the PA alternate report uses additional fields and tables not used by the standard report - but that's a tale for another time. In the mean time, I hope you find this article useful.

Until next post!

Mariano Gomez, MVP
IntellPartners, LLC


Kumar said...

Great find! Thanks for the great article!

Frank Hamelly said...

Thanks MG. This helped me with a similar issue with a modified PO form. Great stuff!

Bose said...

Wonderful guidance! Purchase Order Form

Johnpaul said...

Fantastic article i like it very much. Invoice Template

Unknown said...

Thanks Mariano. This bailed me out. I had a SOP Invoice pointed to the VAT version without my knowledge.


Mariano Gomez said...

Glad to know the article helped.

Mariano Gomez, MVP

Anonymous said...

Can you print a modified PO form (modified using WORD) into a PDF from the Purchase Order Entry window? A customer is looking to print the PO to PDF so they can save a copy of the PO outside of GP. The customer is using CutePDF as the PDF Writer.

Unknown said...

Hi all , I need to change a Purchase Order only add 3 lines of text at the bottom of the page , I followed all the steps, license, create xml file, import it into Office Word , but when I print no change is reflected .

I hope your kind reply .

Thank you

Anonymous said...

Hi, I'm having issues printing trademark ™ ALT+0153 symbol in word templates.
It works fine using the standard report but not the word template.
Any idea why?

Steve Chapman said...

You saved me again, Mariano. Thanks.