Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Sink Save/Save As
WDSI
Is the "CUSTFT80E" dot file laying around anywhere? We've used it in the past and I'm not sure where to find it.
Also, if anyone has any sample code for sinking the save event that would be most helpful. Thanks!
Find more posts tagged with
Comments
Migrateduser
Is this what you are looking for?
' CUSTFT8xEAI - WORKSITE VERSION 8.0 HF5
' SinkObject
'--------1---------2---------3---------4---------5---------6---------7---------8
Option Explicit
' NOTE: To set up a sink for the application's events (DocumentBeforePrint,
' DocumentBeforeSave, etc.), uncomment the lines between the lines
' SINK APPLICATION EVENTS and END SINK APPLICATION EVENTS.
' An example of a sinked application event is between the lines
' SINK APPLICATION EVENT EXAMPLE and END SINK APPLICATION EVENT EXAMPLE.
Private WithEvents objExtensibilitySink As iManO2K.iManageExtensibility
Private WithEvents objEditProfileCmdSink As IMANEXTLib.EditProfileCmd
Private WithEvents objNewVersionCmdSink As IMANEXTLib.NewVersionCmd
Private WithEvents objIManFileSaveCmdSink As IMANEXT2Lib.IManFileSaveCmd
' SINK APPLICATION EVENTS
Private WithEvents objApplication As Word.Application
' END SINK APPLICATION EVENTS
Public Sub SinkIManageExtensibility( _
objExtensibility As iManO2K.iManageExtensibility)
Set objExtensibilitySink = objExtensibility
' SINK APPLICATION EVENTS
Set objApplication = Word.Application
' END SINK APPLICATION EVENTS
End Sub
Private Sub objApplication_DocumentOpen(ByVal Doc As Document)
Dim objDocument As IManage.IManDocument
Set objDocument = objExtensibilitySink.GetDocumentFromPath(Doc.FullName)
If Not objDocument Is Nothing Then
objDocument.Refresh
FootActiveDocument objDocument
End If
End Sub
Private Sub objExtensibilitySink_BeforePrintDialog()
Dim objDocument As IManage.IManDocument
Set objDocument = objExtensibilitySink.GetDocumentFromPath _
(Word.ActiveDocument.FullName)
If Not objDocument Is Nothing Then
objDocument.Refresh
FootActiveDocument objDocument
End If
End Sub
Private Sub objExtensibilitySink_OnCreateNewVersion( _
ByVal objNewVersionCmd As Object)
Dim objDocument As IManage.IManDocument
Set objDocument = _
objExtensibilitySink.GetDocumentFromPath(Word.ActiveDocument.FullName)
If Not objDocument Is Nothing Then
objDocument.Refresh
End If
Set objNewVersionCmdSink = objNewVersionCmd
End Sub
Private Sub objExtensibilitySink_OnEditProfile( _
ByVal objEditProfileCmd As Object)
Set objEditProfileCmdSink = objEditProfileCmd
End Sub
Private Sub objExtensibilitySink_OnIManFileSave(ByVal objIManFileSaveCmd As Object)
Set objIManFileSaveCmdSink = objIManFileSaveCmd
End Sub
Private Sub objIManFileSaveCmdSink_PostOnOK(ByVal pMyInterface As Object)
Dim objDocument As IManage.IManDocument
Set objDocument = objIManFileSaveCmdSink.Context("ImportedDocument")
FootActiveDocument objDocument
End Sub
Private Sub objNewVersionCmdSink_PostOnOK(ByVal pMyInterface As Object)
Dim objDocument As IManage.IManDocument
Set objDocument = _
objNewVersionCmdSink.Context("IManExt.NewVersionCmd.Document")
FootActiveDocument objDocument
End Sub
Private Sub objEditProfileCmdSink_PostOnOK(ByVal pMyInterface As Object)
Dim objDocument As IManage.IManDocument
Dim varSelectedIManDocuments As Variant
varSelectedIManDocuments = _
objEditProfileCmdSink.Context("SelectedNRTDocuments")
Set objDocument = varSelectedIManDocuments(0)
FootActiveDocument objDocument
End Sub
' FootActiveDocument is used to put a footer on the active document.
Private Sub FootActiveDocument(objDocumentToFoot As IManage.IManDocument)
Dim strAuthor As String
' the author of the document to foot
Dim strName As String
' the name of the document to foot
Dim strNumber As String
' the number of the document to foot
Dim strTextString As String
' the text of the footer
Dim strVersion As String
' the version number of the document being imported
' Get the relevant information about the document.
' The parameter to GetAttributeByID is of type AttributeID; refer to
' the object browser for possible values.
strName = objDocumentToFoot.GetAttributeByID(nrName)
strNumber = objDocumentToFoot.GetAttributeByID(nrDocNum)
strVersion = objDocumentToFoot.GetAttributeByID(nrVersion)
strAuthor = objDocumentToFoot.GetAttributeByID(nrAuthor)
' Check if the name of the document does not exist.
If strName = "" Then
' The footer will not contain the name of the document.
'this is the sample default format from WorkSite.
strTextString = strAuthor + " " + strNumber + "_" + strVersion
'example of a different format to replace WorkSite default and format text
'strTextString = strNumber + "-" + strVersion
Else
' The footer will contain the name of the document.
'this is the sample default format from WorkSite.
strTextString = strName + ":" + strAuthor + " " + strNumber + "-" + strVersion
'example of a different format to replace WorkSite default and format text
'strTextString = strNumber + "-" + strVersion
End If
' Set the footer for the active document.
With ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
.Style = wdStyleFooter
.Font.Size = 8
.Text = strTextString 'This is the primary footer
End With
If ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Exists = True Then
With ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage).Range
.Font.Size = 8
.Text = strTextString 'This is the first page footer
End With
End If
End Sub
' This event handler is an example of how to foot a WorkSite document before printing. This event
' is only fired when documents in WorkSite are printed.
'
Private Sub objExtensibilitySink_DocumentBeforePrint(ByVal Doc As Object, _
IgnoreIManagePrint As Boolean, Cancel As Boolean)
Dim objDocument As IManage.IManDocument
Set objDocument = _
objExtensibilitySink.GetDocumentFromPath(Doc.FullName)
If Not objDocument Is Nothing Then
objDocument.Refresh
FootActiveDocument objDocument
End If
End Sub
' Below is a sample event handler which foots the document before every save.
' The portions above which set up the sink to the application's events must be
' uncommented for this event handler to be called.
' SINK APPLICATION EVENT EXAMPLE
'Private Sub objApplication_DocumentBeforeSave(ByVal Doc As Document, _
' SaveAsUI As Boolean, Cancel As Boolean)
'
' Dim objDocument As IManage.IManDocument
' ' a document object as represented by WorkSite
'
' ' The Doc argument is the document being saved.
'
' ' Convert the Word document object to a WorkSite document using the path,
' ' stored in the FullName property of the Word document object.
' Set objDocument = objExtensibilitySink.GetDocumentFromPath(Doc.FullName)
'
' ' GetDocumentFromPath will return Nothing if the document is not a WorkSite
' ' document. Foot the document only if it is a WorkSite document.
' If Not objDocument Is Nothing Then
' objDocument.Refresh
' FootActiveDocument objDocument
' End If
'
'End Sub
' END SINK APPLICATION EVENT EXAMPLE