XmlDataBindings Collection

Microsoft Office Web Components Visual Basic

XmlDataBindings Collection

Workbook XmlDataBindings
Workbook

The XmlDataBindings collection contains all of the XmlDataBinding objects associated with a Spreadsheet component. Each XmlDataBinding object contains configuration data that binds the Spreadsheet component to a data retrieval service, SOAP Web Service, XML file, or a Web Part.

Using the XmlDataBindings Collection

The XMLDataBinding object is a member of the XmlDataBindings collection, which is a collection of all of the XmlDataBinding objects in a Spreadsheet component. Within the collection, individual XmlDataBinding objects are indexed beginning with 1 for the first object, 2 for the second, and so on. You can return a XmlDataBinding object from the XmlDataBindings collection by using theItem property of the collection. The argument for the Item property is the index in the collection of the object you want to return or the binding ID of the object. The binding ID is the value of the ID attribute in the XML that represents the binding. You can find this in the XML Spreadsheet file for the Spreadsheet component (or Spreadsheet Web Part) or by examining the BindingData property of the XmlDataBinding object. You can create an XML Spreadsheet file by creating a data bound spreadsheet using Microsoft Excel and then saving the workbook as an XML Spreadsheet.

You create a new XmlDataBinding object using the Add method of the XmlDataBindings collection. Once you have created the XmlDataBinding object, you can use its BindingData property to specify binding configuration information and you can use the XmlMap property to specify the schema map associated with the binding.

The following example creates the XmlDataBindings object using the XmlDataBindings property of the Workbook object and shows how to work with the binding information:

    

Dim objBindings
Dim objBinding
Dim strBindingInfo

Set objBindings = Spreadsheet1.ActiveWorkbook.XmlDataBindings

For Each objBinding in objBindings
     ' Save the XML binding information to a variable.     
     strBindingInfo = objBinding.BindingData
     ' Work with the binding information here.
Next