Condividi tramite


Workbook.XmlImport Method

Imports an XML data file into the current workbook.

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

Syntax

'Declaration
Function XmlImport ( _
    Url As String, _
    <OutAttribute> ByRef ImportMap As XmlMap, _
    Overwrite As Object, _
    Destination As Object _
) As XlXmlImportResult
XlXmlImportResult XmlImport(
    string Url,
    out XmlMap ImportMap,
    Object Overwrite,
    Object Destination
)

Parameters

  • Url
    Type: System.String

    A uniform resource locator (URL) or a uniform naming convention (UNC) path to an XML data file.

  • Overwrite
    Type: System.Object

    If a value is not specified for the Destination parameter, then this parameter specifies whether or not to overwrite data that has been mapped to the schema map specified in the ImportMap parameter. Set to true to overwrite the data or false to append the new data to the existing data. The default value is true. If a value is specified for the Destination parameter, then this parameter specifies whether or not to overwrite existing data. Set to true to overwrite existing data or false to cancel the import if data would be overwritten. The default value is true.

  • Destination
    Type: System.Object

    The data will be imported into a new XML list at the Range specified.

Return Value

Type: Microsoft.Office.Interop.Excel.XlXmlImportResult
One of the XlXmlImportResult values.

Remarks

Do not specify a value for the Destination parameter if you want to import data into an existing mapping.

The following conditions will cause this method to generate run-time errors:

  • The specified XML data contains syntax errors.

  • The import process was cancelled because the specified data cannot fit into the worksheet.

Use the XmlImportXml method to import XML data that has been previously loaded into memory.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

.NET Framework Security

See Also

Reference

Workbook Interface

Microsoft.Office.Tools.Excel Namespace