Selection.InsertXML Method

Inserts the specified XML text into the specified selection.

Namespace:  Microsoft.Office.Interop.Word
Assembly:  Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)

Syntax

'Declaration
Sub InsertXML ( _
    XML As String, _
    ByRef Transform As Object _
)
'Usage
Dim instance As Selection
Dim XML As String
Dim Transform As Object

instance.InsertXML(XML, Transform)
void InsertXML(
    string XML,
    ref Object Transform
)

Parameters

  • XML
    Type: System.String
    Required String. The XML text to insert.
  • Transform
    Type: System.Object%
    Optional Object. The transform to apply to the inserted XML text.

Remarks

If the specified range or selection contains text, the InsertXML method replaces the existing text.

Use the InsertXML method to insert text marked up with either arbitrary XML or Word XML. The XML must be well formed. If it uses Word XML, then it must also be valid according to the Word XML schema. For more information on the Word XML schema, please refer to the Word XML Content Development Kit, which you can find on the Microsoft Developer Network (MSDN) Web site.

If the specified XML text cannot be inserted into the specified range or selection, an error message is displayed.

See Also

Reference

Selection Interface

Selection Members

Microsoft.Office.Interop.Word Namespace