I have a problem with list item and printing them. I must create workflow or jscript printing this item using template. Steps that I need to do:
- Select item/items on list
- Run workflow or jscript (using button)
- There will show window using template with data from selected item
- In this window should be PRINT button
- Click Print - and then printing
I'm beginner with programming so jscript and custom workflow will can be difficulty. Can anyone have any proposition?
I have found this script:
<script type="text/javascript" language="JavaScript">
//Controls which Web Part or zone to print 'TD ID'
var WebPartElementID = "onetIDListForm"; //SharePoint Main Content ID
//Function to print Web Part
function PrintArea()
{
var bolWebPartFound = false;
if (document.getElementById != null)
{
//Create html to print in new window
var PrintingHTML = '<HTML>\n<HEAD>\n';
//Take data from Head Tag
PrintingHTML += document.getElementsByTagName('head')[0].innerHTML;
PrintingHTML += '\n</HEAD>\n<BODY class="printSQS">\n';
var WebPartData = document.getElementById(WebPartElementID);
if (WebPartData != null)
{
PrintingHTML += WebPartData.innerHTML;
bolWebPartFound = true;
}
else
{
bolWebPartFound = false;
alert ('Cannot Find Web Part');
}
}
PrintingHTML += '\n</BODY>\n</HTML>';
//Open new window to print
if (bolWebPartFound)
{
var PrintingWindow = window.open("","PrintWebPart",
"toolbar,width=800,height=600,scrollbars,resizable,menubar");
PrintingWindow.document.open();
PrintingWindow.document.write(PrintingHTML);
PrintingWindow.document.close();
// Open Print Window
PrintingWindow.print();
}
}
</script>
By http://amitphule.blogspot.com/2011/09/print-button-on-sharepoint-page.html
Every think is OK,but how I can define the place where template is?