实现在一个文档库里使用不同的文档模板

Imagine you have a team site dedicated to the creation of process based
documents or forms. You would have a document library for each template and
the user could go into the appropriate document library and create a new
document from there.
Another approach would be to build a Web Part that lists all the document
libraries on the site (as can be seen below) and provide a create document
function in the list.

Office 2003 includes a number of ActiveX controls that interact with
SharePoint. One of them is the OpenDocuments control which has the
CreateNewDocument method which is used when you click on the New Document
link in a document library.

      CreateNewDocument Method
      Creates a document based on the specified document template and
returns a Boolean value. True indicates that the document is successfully
created.

      Syntax
      expression.CreateNewDocument(bstrTemplateLocation,
bstrDefaultSaveLocation)

            expression An expression that returns an OpenDocuments object.
            bstrTemplateLocation Required String. The URL of the document
template from which the document is created, or the programmatic identifier
(progID) of the application to be invoked when creating the document.
            bstrDefaultSaveLocation Required String. The path specifying a
suggested default location for saving the new document.


To build the list of document libraries you need to add an XML Web Service
in the Data Source Catalog using Front Page for the Lists.asmx service and
insert it onto a Web Part Page as a data view. Specify in the Filter view
setting the following conditions:



Add a column to the view using the source code window that looks like
this...

<td class="ms-vb"><xsl:variable name="message" select="concat('CreateDoc(',
'',&quot;'&quot;,'', @DocTemplateUrl, '',&quot;'&quot;,'',')')"/><a
href="javascript:"><img alt="Create new document"
src="../_layouts/images/newdoc.gif"/></a></td>

Add a JavaScript function in the page code
<SCRIPT language="JavaScript">
function CreateDoc(strTemplate)
{
    NewDocument = new ActiveXObject("SharePoint.OpenDocuments.2");

      // need to work out strSaveLocation from the current page base url +
part of the template relative url
      //Sig should be able to help with this ...


        if (NewDocumentButton.CreateNewDocument(strTemplate, strSaveLoc))
        {
            window.onfocus = RefreshOnFocus;
        }

}
</SCRIPT>

历史评论

mzc

这个方法我试过,但没有成功,能否指点一下,或介绍具体一点

评论为旧站历史记录,本站不再接受新评论。