Overview
Kappris allows macro control by means of a single template, KapprisWord.dot. An alternative template is KapprisInterwoven.dot, which offers the same facilities but is designed to work in the IManage/Interwoven environment.
Kappris Word integration presents an event-driven architecture and, by handling events, the macro programmer can customise Kappris to an extent way beyond that offered by Kappris Control Panel.
When Kappris printing is invoked in Word, it can raise a total of 7 events:
KapprisAfterCancel KapprisAfterError KapprisAfterImprint KapprisAfterPrint KapprisBeforeDialog KapprisBeforeImprint KapprisBeforePrint
Each of these events makes available a Kupris object and a Job object. By manipulating these objects and working with other arguments supplied with the event call, the macro programmer can take much finer control of Kappris.
Restrict yourself to editing only the KapprisIntegration code module within the KapprisWord or the KapprisInterwoven template.
Keep your changes to the KapprisIntegration module by calling routines in your own Word templates rather than adding copious amounts of code to KapprisIntegration.
Syntax
Private Sub KapprisAfterCancel(ByVal Kupris As Kupris.IKupris2, ByVal Job As KappSrvr.IJob)
'Occurs after the user clicks Cancel on the print dialog
Private Sub KapprisAfterError(ByVal Kupris As Kupris.IKupris2, ByVal Job As KappSrvr.IJob, ByVal ErrMsg As String, Optional Handled As Boolean = False)
'Occurs after any error encountered that stops printing
'Use Handled = True if Kappris is to take no action (eg display a message) for this error
Private Sub KapprisAfterImprint(ByVal Kupris As Kupris.IKupris2, ByVal Job As KappSrvr.IJob, ByVal Index As Long, ByVal IndexWithinJob As Long)
'Occurs immediately after the settings for an imprint have been written to the Job
'Use the IndexWithinJob parameter to query the Job parameters for this imprint
'The Index parameter gives the index of this imprint in the whole print request
Private Sub KapprisAfterPrint(ByVal Kupris As Kupris.IKupris2, ByVal Job As KappSrvr.IJob)
'Occurs after printing process is complete
Public Sub KapprisBeforeDialog(ByVal Kupris As Kupris.IKupris2, ByVal Job As KappSrvr.IJob, Optional ShowDialog As Boolean = True, Optional Cancel As Boolean = False)
'Occurs before the print dialog shows
'Use the ShowDialog parameter to enable/disable display of the dialog
'Use Kupris.Category = <RequiredCategory> to set a category in the dialog
'Use Kupris.PrintMode = <RequiredPrintMode> to set a print mode in the dialog
'Use Cancel = True to cancel the printing process
Private Sub KapprisBeforeImprint(ByVal Kupris As Kupris.IKupris2, ByVal Job As KappSrvr.IJob, ByVal Index As Long, ByVal IndexWithinJob As Long, PrintNow As Boolean, CancelImprint As Boolean)
'Occurs after an imprint's parameters have been stored in the Job but before
'the imprint is printed
'Use the IndexWithinJob parameter to query the Job parameters for this imprint
'The Index parameter gives the index of this imprint in the whole print request
'Use PrintNow to get the imprint to be printed immediately after this event handler
Private Sub KapprisBeforePrint(ByVal Kupris As Kupris.IKupris2, ByVal Job As KappSrvr.IJob, Optional Cancel As Boolean = False)
'Occurs after the print dialog has closed and before the printing process actually starts
'This event will not occur if the dialog did not close with the OK button
Code Samples
Print le tter and copy with out displaying the print dialog
Remove the logo for the letter and put it back for the copy
Print a label whenever we print on letterhead stationery