Edit

Share via


CustomXMLNode.InsertNodeBefore Method

Definition

Inserts a new node just before the context node in the tree.

public void InsertNodeBefore (string Name = "", string NamespaceURI = "", Microsoft.Office.Core.MsoCustomXMLNodeType NodeType = Microsoft.Office.Core.MsoCustomXMLNodeType.msoCustomXMLNodeElement, string NodeValue = "", Microsoft.Office.Core.CustomXMLNode NextSibling = default);
abstract member InsertNodeBefore : string * string * Microsoft.Office.Core.MsoCustomXMLNodeType * string * Microsoft.Office.Core.CustomXMLNode -> unit
Public Sub InsertNodeBefore (Optional Name As String = "", Optional NamespaceURI As String = "", Optional NodeType As MsoCustomXMLNodeType = Microsoft.Office.Core.MsoCustomXMLNodeType.msoCustomXMLNodeElement, Optional NodeValue As String = "", Optional NextSibling As CustomXMLNode = Nothing)

Parameters

Name
String

Represents the base name of the node to be added.

NamespaceURI
String

Represents the namespace of the element to be added. This parameter is required if adding nodes of type msoCustomXMLNodeElement or msoCustomXMLNodeAttribute, otherwise it is ignored.

NodeType
MsoCustomXMLNodeType

Specifies the type of the node to be added. If the parameter is not specified, it is assumed to be a node of type msoCustomXMLNodeElement.

NodeValue
String

Used to set the value of the node to be added for those nodes that allow text. If the node doesn’t allow text, the parameter is ignored.

NextSibling
CustomXMLNode

Represents the context node.

Remarks

If the context node is not present when adding a node of type msoCustomXMLNodeElement, msoCustomXMLNodeComment, or msoCustomXMLNodeProcessingInstruction, the new node is added to the last child of the context node. If the operation would result in an invalid tree structure, the insertion is not performed and an error message is displayed.

Applies to