https://issues.apache.org/ooo/show_bug.cgi?id=125306

bmarcelly <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #4 from bmarcelly <[email protected]> ---
Your attachment 83738 contains 6467 data lines, followed by 194968 lines of
empty data. So the code searching for the End of Used data returns a value for
count = 201435.
For my test I used only the range A1:C6467

Your code uses the deprecated structure com.sun.star.util.SortField and
declares an array of 3 structures, using only one.

Stable sort was introduced in OpenOffice.org version 3.1. 
The following code works, and the sort is stable when you sort on column 1
(column B):

Function sort(col As Integer, doc As Object) As Long
    Dim aSortFields(0) As New com.sun.star.table.TableSortField

    Dim aSortDesc(0) As New com.sun.star.beans.PropertyValue
    Dim count As Long
    Dim cell As Object, Sheet As Object, curs As Object
    Dim oSortRange As Object

    Sheet = doc.Sheets.GetByName("Sheet1")

    ' for simplicity, set range hard coded
    oSortRange = Sheet.getCellRangeByName("A1:C6467")

       aSortFields(0).Field = col
       aSortFields(0).IsAscending = TRUE

       aSortDesc(0).Name = "SortFields"
       aSortDesc(0).Value = aSortFields()
       oSortRange.Sort(aSortDesc()) 
End Function

Conclusion : invalid bug report

-- 
You are receiving this mail because:
You are the assignee for the issue.
You are watching all issue changes.

Reply via email to