我想取出spread控件某一行的记录,该怎么写呢?

解决方案 »

  1.   

    fpSpread1.GetText fpSpread1.ActiveCol, fpSpread1.ActiveRow, fpvalue
    示例中有  RetrieveData中
      

  2.   

    '读取单元格的值
    '参数vSign是取ComboBox
    '型列中数据值时所用,如ComboBox中的
    '显示内容为"Y-是",但要取"Y",则vSign为"-"
    Public Function CellGetValue(ByVal vSpread As vaSpread, ByVal vRow As Integer, _
        ByVal vCol As Integer, Optional ByVal vExtended As Boolean = False, _
        Optional ByVal vSign As String = "") As Variant    Dim nRow As Integer, nCol As Integer, nPos As Integer
        
        If vRow < -1 Or vCol < -1 Then Exit Function
        With vSpread
            nRow = .Row
            nCol = .Col
            .Row = vRow
            .Col = vCol
            Select Case .CellType
                Case eCellType.TYPE_DATE
                    If .Value = "" Then
                        CellGetValue = CDate("1990-01-01")
                    Else
                        CellGetValue = .Text
                    End If
                
                Case eCellType.TYPE_EDIT, eCellType.TYPE_STATIC_TEXT
                    If .Value = "" Then
                        CellGetValue = ""
                    Else
                        CellGetValue = .Value
                    End If
                
                Case eCellType.TYPE_FLOAT, eCellType.TYPE_INTEGER
                    If .Value = "" Then
                        If vExtended = True Then
                            CellGetValue = Null
                        Else
                            CellGetValue = 0
                        End If
                    Else
                        CellGetValue = .Value
                    End If
                
                Case eCellType.TYPE_COMBOBOX
                    If vExtended Then
                        'CellGetValue = IIf(.Value = "", -1, .Value)
                        nPos = InStr(1, .Text, vSign)
                        If nPos <= 1 Then nPos = 2
                        CellGetValue = Mid(.Text, 1, nPos - 1)
                    Else
                        CellGetValue = .Text
                    End If
                
                Case eCellType.TYPE_BUTTON, eCellType.TYPE_CHECKBOX
                    If .Value = "" Then
                        CellGetValue = -1
                    Else
                        CellGetValue = .Value
                    End If
                    
                Case eCellType.TYPE_TIME
                    CellGetValue = .Text
                
                Case eCellType.TYPE_PIC, eCellType.TYPE_PICTURE, eCellType.TYPE_OWNER_DRAWN
                
                
                Case Else
                    CellGetValue = .Value
            
            End Select
        End With
    End Function