WorkbookBase.XmlNamespaces Property

Gets an Microsoft.Office.Interop.Excel.XmlNamespaces collection that represents the XML namespaces contained in the workbook.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property XmlNamespaces As XmlNamespaces
    Get
public XmlNamespaces XmlNamespaces { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.XmlNamespaces
An Microsoft.Office.Interop.Excel.XmlNamespaces collection that represents the XML namespaces contained in the workbook.

Examples

The following code example uses the XmlNamespaces property to write the Uniform Resource Identifier (URI) for each XmlNamespace in the workbook to column A of worksheet Sheet1.

This example is for a document-level customization.

Private Sub DisplayXmlNamespaceURI()
    If Me.XmlNamespaces.Count = 0 Then
        MsgBox("The current workbook does not have " & _
            "any XML namespaces.")
    Else
        Dim i As Integer
        For i = 0 To (Me.XmlNamespaces.Count)
            Globals.Sheet1.Range("A" & i).Value2 = _
                Me.XmlNamespaces(i).Uri
        Next i
    End If
End Sub
private void DisplayXmlNamespaceURI()
{
    if (this.XmlNamespaces.Count == 0)
    {
        MessageBox.Show("The current workbook does not have " +
            "any XML namespaces.");
    }
    else
    {
        for (int i = 0; i < this.XmlNamespaces.Count; i++)
        {
            Globals.Sheet1.Range["A" + i, missing].Value2 =
                (this.XmlNamespaces[i].Uri);
        }
    }
}

.NET Framework Security

See Also

Reference

WorkbookBase Class

Microsoft.Office.Tools.Excel Namespace