Export (0) Print
Expand All
Expand Minimize

Workbook.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 (in microsoft.office.tools.excel.dll)

public virtual XmlNamespaces XmlNamespaces { get; }

Property Value

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

XML features, except for saving files in the XML Spreadsheet format, are available only in Microsoft Office Professional Edition 2003 and Microsoft Office Excel 2003.

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.

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);
        }
    }
}

Show:
© 2014 Microsoft