Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example requires VB 6. You need to add references to Microsoft ActiveX Data Objects 2.1 or later, the Microsoft Data Adapter Library, and Microsoft XML, version 2.0. This example will use the ExportRangeToXMLBuffer method to create an XML buffer and then assign that buffer to the Microsoft DataGrid (OLEDB).

C++

BSTR bstr = NULL;
m_Spread.ExportRangeToXMLBuffer(1, 0, 3, 2, "Root", "Collection", &bstr, ExportToXMLUnFormattedData, "");

Visual Basic

Private Sub Command1_Click()
    Dim Buffer As String
    Dim dso As New XMLDSOControl
    Dim doc As IXMLDOMDocument
    Dim da As New DataAdapter
    Dim rs As New ADODB.Recordset

    Call fpSpread1.ExportRangeToXMLBuffer(1, 0, 3, 2, "Root", "Collection", Buffer, ExportToXMLUnFormattedData, "")
    ' Load the XML data into an XML DSO control
    Set doc = dso.XMLDocument
    doc.loadXML (Buffer)
    ' Map the DSO into a new Recordset object
    ' using a     DataAdapter
    Set da.Object = dso
    Set rs.DataSource = da
    Set DataGrid1.DataSource = rs.DataSource
End Sub

Private Sub Form_Load()
    fpSpread1.Col = 1
    fpSpread1.Row = 0
    fpSpread1.Text = "Last"
    fpSpread1.Col = 2
    fpSpread1.Row = 0
    fpSpread1.Text = "First"
    fpSpread1.Col = 3
    fpSpread1.Row = 0
    fpSpread1.Text = "Serial"
    fpSpread1.Col = 1
    fpSpread1.Row = 1
    fpSpread1.Text = "Jones"
    fpSpread1.Col = 2
    fpSpread1.Row = 1
    fpSpread1.Text = "Greg"
    fpSpread1.Col = 3
    fpSpread1.Row = 1
    fpSpread1.Text = "1234"
    fpSpread1.Col = 1
    fpSpread1.Row = 2
    fpSpread1.Text = "Smith"
    fpSpread1.Col = 2
    fpSpread1.Row = 2
    fpSpread1.Text = "Theresa"
    fpSpread1.Col = 3
    fpSpread1.Row = 2
    fpSpread1.Text = "5678"
End Sub

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.