Events


ObjectEventTypeRequirement SetDescription
CustomXMLPartNodeDeletedCustomXmlPartsRenamed in 1.1 from DataNodeDeleted
Word only
 NodeInsertedCustomXmlPartsRenamed in 1.1 from DataNodeInserted
Word only
 NodeReplacedCustomXmlPartsRenamed in 1.1 from DataNodeReplaced
Word only
DocumentActiveViewChangedDocumentEvents 
 SelectionChangedDocumentEvents 
MatrixBindingBindingSelectionChangedMatrixBindings 
 BindingDataChangedMatrixBindings 
TableBindingBindingSelectionChangedTableBindings 
 BindingDataChangedTableBindings 
TextBindingBindingSelectionChangedTextBindings 
 BindingDataChangedTextBindings 
SettingsActiveViewChangedSettings 
 SettingsChangedSettings 
RoamingSettings  Outlook only

All the above objects also have the following methods:

addHandlerAsync(eventType, handler [,Options], callback);

subscribes a handler to an event

removeHandlerAsync(eventType, handler [,Options], callback);

unsubscribes a handler from an event


eventType - An EventType enumeration. You can also use a text string "documentSelectionChanged"
handler - Either a named or anonymous inline function. You should always use a named function to allow it to be removed.
options - The only available parameter is asyncContxt
callback - The AsyncResult.value is always undefined


( function () { 

   Office.initialize = function (reason) {
      $(document).ready(function () {
         Office.context.document.addHandlerAsync(
            Office.EventType.DocumentSelectionChanged,
            event_onDocumentSelectionChanged,
            callback_DocumentSelectionChanged
   );
   
   function event_onDocumentSelectionChanged(eventArgs) {
   // called when asynchronous operation completes
   // the eventArgs contains a reference to a DocumentSelectionChangedEvent Args object
   }

   function callback_DocumentSelectionChanged(result) {
      var dataValue = result.value;
   }

} ) ();

eventArgs Parameter


eventArgs.binding
eventArgs.document - access the document that raises the event.



Event Scenarios

All events fall into one of the 4 different categories:
Office.initialize events
Document level selection change events
Bindinglevel selection and data change events
Settings changed events



© 2018 Better Solutions Limited. All Rights Reserved. © 2018 Better Solutions Limited TopNext