InfoPath Print View for Word

by Sharee English

ç

 

Sharee English

Views are a native part of InfoPath 2007 that allow us to create one data source, but display the data in many different ways, even to different people in different ways. For example you might have one view for an order form and another view for the order summary. However, there is a special view called Print View for Word that is entirely different. This option allows you to designate an XSLT that will take the form data and apply the transform to render out WordProcessingML, which can be opened in Word 2003 or later. To create a Word Print view complete the following steps:


 

  1. Install the InfoPath 2003 SDK (yes, I know it states 2003).
  2. Run the Word Print wizard called wizard.hta located in %Program Files%\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Tools\WordPrint.
  3. Click Next to start the wizard.
    NOTE: If you receive an error message regarding missing or unregistered DLL files, go to Start Run and enter regsvr32 “C:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Tools\WordPrint\wordprint.dll”. You may also have to run this for html2xhtml.dll and imageDecode.dll
  4. Once you launch the wizard you will see the Welcome to the InfoPath to Word Wizard dialog box. Click Next.
  5. On the next screen, browse to your form and select it. Note that you could just use a schema, but the wizard provides some additional functionality if you point to the InfoPath form template (*.xsn). In my example I am opening my Order Form.

  6. Click Next.
  7. The next screen offers the option of opening Word 2003 (if you have Word 2007 installed it will open that instead, but it will not change the text on the button).
  8. Click the Open Word 2003 button.
  9. You’ll be presented with a blank document, with the XML Structure pane open. The form’s XML structure is already attached to the list at the bottom of the pane.
  10. You can now create the form as shown below. When you are done with the Word form, close and save the document.

  11. Return to the wizard and click Next.
  12. One the next page, browse to the location where you stored the word file and click Next.
  13. Give your Word Print view a memorable name.
  14. Click Next and Finish. This will generate the XSLT file in the same location as the Word document. Click Congratulations on the final screen.
  15. Now reopen your InfoPath form in the InfoPath 2007 design mode.
  16. Open the Design Task pane and click Views
  17. Click the “Add Print View for Word” link at the bottom of the Views task pane.
  18. This wizard will install the XSL file into your InfoPath form template. Click Next. 
  19. Browse to the location where the Word print wizard stored your XSL file and click Next.
  20. Give your Word print view a name and click Next
  21. Click Finish.

    Your print view will not show up in the views listing.

  22. Select a view and click the View Properties.
  23. Select the Print Settings tab and set the print view to the Word Print view you just created.

  24. You can test it by filling out your data and clicking print.

Sharee English (MCSD, MCAD, MCT) is the Director of Information Services at SeattlePro Enterprises, an IT training and consulting company. She started her career as a programmer, delving into Web technologies almost twenty years ago. Today she is a highly educated executive with background in software development, training, authoring, management, operations, administration and sales. Sharee holds a Master of Arts in Management (emphasis in Information Systems), a Bachelor of Science (B.S.) in Computer Science and a B.S. in Mathematics.


If you would like to provide feedback on this article, please click here.


Copyright ©2009 SeattlePro Enterprises. All rights reserved.