WorkbookBase.XmlNamespaces Property

Definition

Gets an XmlNamespaces collection that represents the XML namespaces contained in the workbook.

public:
 property Microsoft::Office::Interop::Excel::XmlNamespaces ^ XmlNamespaces { Microsoft::Office::Interop::Excel::XmlNamespaces ^ get(); };
public Microsoft.Office.Interop.Excel.XmlNamespaces XmlNamespaces { get; }
member this.XmlNamespaces : Microsoft.Office.Interop.Excel.XmlNamespaces
Public ReadOnly Property XmlNamespaces As XmlNamespaces

Property Value

An 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 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].Value2 =
                (this.XmlNamespaces[i].Uri);
        }
    }
}
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

Applies to