Edit

Office.NodeReplacedEventArgs interface

Provides information about the replaced node that raised the nodeReplaced event.

Remarks

Examples

// Event handler for the NodeReplaced event added in CustomXmlPart.addHandlerAsync.
function onNodeReplaced(eventArgs: Office.NodeReplacedEventArgs) {
    // Logs information about the replaced and new nodes.
    console.log("NodeReplaced event fired.");
    console.log("  Is undo/redo: " + eventArgs.isUndoRedo);
    eventArgs.oldNode.getXmlAsync((result) => {
        if (result.status === Office.AsyncResultStatus.Succeeded) {
            console.log("  Old node XML: " + result.value);
        }
    });
    eventArgs.newNode.getXmlAsync((result) => {
        if (result.status === Office.AsyncResultStatus.Succeeded) {
            console.log("  New node XML: " + result.value);
        }
    });
}

Properties

isUndoRedo

Gets whether the replaced node was inserted as part of an undo or redo operation by the user.

newNode

Gets the node that was just added to the CustomXMLPart object.

Note that this node may have children, if a subtree was just added to the document.

oldNode

Gets the node which was just deleted (replaced) from the CustomXmlPart object.

Note that this node may have children, if a subtree is being removed from the document. Also, this node will be a "disconnected" node in that you can query down from the node, but you cannot query up the tree - the node appears to exist alone.

Property Details

isUndoRedo

Gets whether the replaced node was inserted as part of an undo or redo operation by the user.

isUndoRedo: boolean;

Property Value

boolean

newNode

Gets the node that was just added to the CustomXMLPart object.

Note that this node may have children, if a subtree was just added to the document.

newNode: CustomXmlNode;

Property Value

oldNode

Gets the node which was just deleted (replaced) from the CustomXmlPart object.

Note that this node may have children, if a subtree is being removed from the document. Also, this node will be a "disconnected" node in that you can query down from the node, but you cannot query up the tree - the node appears to exist alone.

oldNode: CustomXmlNode;

Property Value