OpenXMLDocuments.CustomizeTemplate2 Method

OpenXMLDocuments.CustomizeTemplate2 Method

Last modified: July 10, 2008

Applies to: SharePoint Foundation 2010

Opens the specified XML document or form template for customization within its associated application based on the specified instance of Internet Explorer.

expression.CustomizeTemplate2(pdisp, bstrSolutionLocation)


An expression that returns an OpenXMLDocuments Control object.


An Object representing a pointer to the Internet Explorer instance that is calling the CustomizeTemplate2 method. Using a null value for this argument results in the method being executed on the primary Internet Explorer thread. As an alternative, you can use the CustomizeTemplate method if you do not need to pass an object with this argument.


A string that contains the URL of the location of the document or form template to open for customization.

true if the XML document or form template successfully opens; otherwise false.

The following example opens an XML document or form template for customization, whose location is specified by the value for the strTempLoc variable that is passed to the CustomizeTemplate2 method. The example assumes the existence of a form named frmCustomizeDoc that has one input box named TempLocation.

<script language="JavaScript">
function customizeDocument()
   // Create an instance of the OpenXMLDocuments object.
   xmlDocObject = new ActiveXObject("SharePoint.OpenXMLDocuments.1");

   // If the OpenXMLDocuments object was successfully created,
   // get the template location from the form's input box.
   if (xmlDocObject)
      var strTempLoc = document.frmCustomizeDoc.TempLocation.value;

      // Open the XML document or form template for customization.
      xmlDocObject.CustomizeTemplate2(window, strTempLoc);

© 2016 Microsoft