Affichage des articles dont le libellé est print a sharepoint form. Afficher tous les articles
Affichage des articles dont le libellé est print a sharepoint form. Afficher tous les articles

vendredi 7 novembre 2008

Printing a form in sharepoint

After a deep search on how to print a form in SharePoint, i led to a solution of javascript integration that will get the whole form and put it on a popup and after will print that popup and close i tat the end.
Here’s the function :
function print_All()
{
var DocumentContainer = document.getElementById('view_all');
var WindowObject = window.open('', "Printing form", "width=800, height=500, top=250, left=345, toolbar=no, scrollbars=no, status=no, resizable=no");
WindowObject.document.write(DocumentContainer.innerHTML);
WindowObject.document.close();
WindowObject.focus();
WindowObject.print();
WindowObject.close();
}
Explanation :
· « var DocumentContainer = document.getElementById('view_all'); » :
Th id (view_all) will be the id that you’ll assign to the tags that include the whole form code, its localised directly ater the tag.



· Now you could just use the WindowObjet.document.write(DocumentContainer) directly without adding the tags above, or you could reform your popup by adding the basic html page tags(), and then attach it to a stylesheet for more sweet display or adding javascript to your popup.


for that exemple, i used dispform.aspx content, of course you could apply it to the rest of form.
i hope it will help you on your job or studies, if you have a question or wondering about something releated to that, dont hesitate to contact me about it.