- Show/Hide DIV tags
- onload event of BODY tag
- you are not allowed to talk to window.external.Window.XDocument; when using ASP.NET pages in a fully trusted, signed form.
Printing the Task pane’s content
A possible solution is using the onClick event of the anchor tag. In this way you are sure that the window.print() method is called and the Print window will appear.
There is no other way to print the content of a custom task pane. So use the window.print();
Export to Word and Excel
It is quit simple to export your custom task pane content to Word and Excel. Because Word and Excel supports HTML, we can save the content of our custom task pane (html) as Word or Excel document
Suppose you an ASP.NET web page (.aspx) which button to export content to Word and Excel.
When the user clicks on the ‘export to Word’ button, we will dynamically add a very small IFrame tag to the page which will call another ASP.NET page. This page is responsible to generate the word or excel document. You can use the QueryString to add a parameter which indicates the type of export (xls/doc).
Response.ContentType = @"application/msword";
Response.Write(“your html content”);
The Content Types are defined in the register (HKEY_CLASSES_ROOT). Select the .doc or .xls folder and have a look at the Content Type.
When clicking on the ‘Export to Word’ button, a download window will pop up to open or save your document.
Use HTML pages in fully trusted, signed forms
It is impossible to call window.external.Window.XDocument when using an ASP.NET page in a fully trusted, signed form. The external window seems to be unavailable at that moment.
If we use an static HTML page as Task pane, we can access the external window!
I suggest to communicate from InfoPath 2003 to the task pane. The communication in the other way is quit difficult if you use fully trusted, signed forms.
Using parameters in HTML Task Pane
It is possible to use a QueryString, also with a static HTML page which is included as resource file. Just call aHtmlTaskpaneObj.Navigate("start.html?key=value");
Hiding Task panes at startup
It is not allowed to hide Task Panes in the Start Up method because not all InfoPath objects are loaded at that time. So it is possible that your Task pane is not hidden, when the form is started. The time the task pane needs to hide depends on the form load.