Infopath 2010 打印按钮

SharePoint 2010 Infopath Print Button

SharePoint 2010 Infopath Print Button

I received a request to put a print button within a List Item display view so that one could easily print the current item they’re viewing.  After searching for a way to put a print button within the Infopath form itself (and coming up empty), I figured out how to simply add it to the page that displays the form.

 

The end goal

Infopath 2010 打印按钮_第1张图片

 

Once you have your Infopath form put together and published to a List, go to the List page.

1. Click on the “List” tab under List Tools

2. Click on the drop down arrow on the “Modify Form Webparts” button (pictured)

Infopath 2010 打印按钮_第2张图片

 

3. Select “(Item) Display Form”

4. This will take you to an edit page screen with your Infopath form set as a webpart

 

5. Add a “Content Editor Webpart” to the page

Infopath 2010 打印按钮_第3张图片

6. Edit your new webpart’s source and paste in the following:

 

<input type="button" value=" Print this page "
onclick="window.print();return false;" />

 

Note: <form> tags are not required

This adds a print button to the page that uses the default print call within a browser.  Since we edited the “Display” form, the button will not appear if a user is editing the form or creating a new item.

Of course, the best part of this discovery is the added bonus of being able to add extra code to our Infopath forms, making them a much more versatile tool than they were before.

你可能感兴趣的:(Path)