https://bugs.documentfoundation.org/show_bug.cgi?id=89216

            Bug ID: 89216
           Summary: Annoying feature: empty cell treated as zero within
                    range/array
           Product: LibreOffice
           Version: 4.3.3.2 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: major
          Priority: medium
         Component: Spreadsheet
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 113216
  --> https://bugs.documentfoundation.org/attachment.cgi?id=113216&action=edit
Contains basic function that stacks nonempty content of cells of given range

It seems impossible for basic function to identify empty cell from zero at
given array range.

Expecting: VarType of Variant of empty cell is either Empty or Null.
Feature(bug?): VarType of Variant of empty cell is actually returned as Double.


Function StackNonEmpty( range As Variant, delimiter As String )
    Dim result As String

    result = ""

    If NOT IsMissing( range ) Then
        If NOT IsArray( range ) Then
            result = range
        Else
        Dim oCell As Variant
        Dim bInclude, bString as Boolean
        Dim sCell As String
        Dim sType As String

        Dim row, col As Integer
            For row = LBound( range, 1 ) To UBound( range, 1 )
                For col = LBound( range, 2 ) To UBound( range, 2 )
                    oCell = range( row, col )
            Select Case VarType( oCell )
            Case 0
            bInclude = False
            bString = False
            sType="Empty"
            Case 1
            bInclude = False
            bString = False
            sType="Null"
            Case 2
            bInclude = True
            bString = False
            sType="Integer"
            Case 3
            bInclude = True
            bString = False
            sType="Long"
            Case 4
            bInclude = True
            bString = False
            sType="Single"
            Case 5
            bInclude = True
            bString = False
            sType="Double"
            Case 7
            bInclude = True
            bString = False
            sType="Date"
            Case 8
            bInclude = True
            bString = True
            sType="String"
            Case 9
            bInclude = False
            bString = False
            sType="Object"
            Case 11
            bInclude = True
            bString = False
            sType="Boolean"
            Case 12
            bInclude = False
            bString = False
            sType="Variant"
            Case Else
            bInclude = False
            bString = False
            sType="Unexpected"
            End Select

                    If bInclude Then
                        If bString Then
                            sCell = range( row, col )

                    If Len( sCell ) > 0 Then
                            If result <> "" Then
                                result = result & delimiter
                            End If
                            result = result & sCell & ": " & sType
                        End If
                        Else
                            If result <> "" Then
                            result = result & delimiter
                        End If
                        result = result & oCell & ": " & sType
                        End If
                    End If
                Next
            Next
        End If
    End If

    StackNonEmpty = result
End Function

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to