Print List Item With InfoPath Form

As we all know,if we change display form of a list item to infopath form,there can't find the print preview button on the ribbon:

If we want to print this form, we need to add a print button,but how to do it,just follow the following steps:

First,trun back to the list,on the ribbon area,click "List"-"Modify Form Webparts",choose "(Item) Display Form":

Then,click "Add Webpart" on the page area,select "Media and Content"-"Content Editor Webpart",click "Add":

Then,modify the content editor webpart,click "Modify Html Code":

Add the following code:

View Code
 1 <script src="/_layouts/jquery.min.js" type="text/javascript"></script>
2 <script src="/_layouts/jquery.PrintArea.js" type="text/javascript"></script>
3
4 <script type="text/javascript">
5 $(document).ready(function () {
6 $("#print_button").click(function(){
7 $("#WebPartWPQ2").printArea();
8 });
9 });
10 </script>
11 <input id="print_button" type="button" value="打 印"/>

Before we do this,we should add "jquery.min.js" and "jquery.PrintArea.js" to this folder on SharePoint Server:"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\","jquery.PrintArea.js" can be downloaded from the internet.

"WebPartWPQ2" is the area id we want to print.

作者:Statmoon
         
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
posted @ 2012-02-24 16:32  Statmoon  阅读(499)  评论(0编辑  收藏  举报