Sorry there is a typo in the output of the SortDescriptor, its
TableSortField.Field matches the one set to (I mixed up the output of
different runs with different variants in effect). So in this example
(trying to sort the columns by Name), "Field=1", which the
SortDescriptor shows as well (ie. "1", and not "2").

However, in this case something strange happens as well, which I forgot
to report: the rows "A25" (the one indicated to sort by) and "A27" get
exchanged in the (unsorted) result !

---rony

On 18.07.2010 15:48, Rony G. Flatscher wrote:
> Hi there,
>
> in the process of creating a little nutshell to demonstrate how to use
> the XSortable.sort(props) methods it is possible to sort the rows of a
> cell range by columns successfully (including variants to copy the
> sorted result to a different cell in the spreadsheet).
>
> Trying to do the same for the transposed cell range (having copied the
> cell range and pasted it with "transpose"), ie. now sorting the colums
> of a cell range by rows, has not yielded a working solution for me,
> although I have been trying for a couple of hours now to analyze
> possible causes.
>
> The layout of the table with the cell range in question is roughly:
>
>        A           B                C               D 
>
>     24 CustNr      1                19              99
>     25 Name        Zeppelin, Inc.   AlphaOmega        BigCompany
>     26 Country     Germany          Netherlands     Austria
>     27 LastOrder   2017-01-02       2029-12-17      2059-05-20
>       
>
> For sorting the columns in range "A24:D27" by row "2" (Country)
> ascendingly the following definitions are undertaken:
>
>     * one "com.sun.star.table.TableSortField" object is created and set
>       as follows: Field=[2] IsAscending=[true] IsCaseSensitive=[false]
>     * the following properties are created and supplied as a sequence to
>       XSortable.sort():
>           o [BindFormatsToContent]=[true]
>             [ContainsHeader]=[true]
>             [IsSortColumns]=[false]
>             [SortFields]= a TableSortField sequence with one member
>             being set to the values given above
>
> Executing the sort does not sort the range as expected, there is no
> pattern so far that I could detect in what happens.
>
> Fetching the SortDescriptor from the XSortable with
> createSortDescriptor(), immediately after the sort() was invoked
> (assuming, which may be false, that the values shown should match the
> explicit settings in the submitted property sequence) shows:
>
>     * [IsSortColumns]=[false]
>       [ContainsHeader]=[true]
>       [MaxFieldCount]=[3]
>       [SortFields]=[[Lcom.sun.star.table.TableSortField;@ccc588]
>         -> Field=[1] IsAscending=[1] IsCaseSensitive=[0]
>       [BindFormatsToContent]=[true]
>       [CopyOutputData]=[false]
>       [outputposition]=[com.sun.star.table.celladdr...@140c281]
>         -> Sheet=[0] Column=[0] Row=[23]
>       [IsUserListEnabled]=[false]
>       [UserListIndex]=[false]
>
> As "IsSortColumns" was set to false (and even the descriptor sets it to
> false), I am wondering why this does not work.
>
> Maybe I miss something important (even something obvious), hence the
> request for hints, ideas.
>
> TIA,
>
> ---rony
>
> P.S.: Doing the same sort interactively via the GUI works.
> P.P.S.: Used the information found in
> <http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Sorting>
> and quite a few related hits via Google, which discuss sorting, but I
> found nothing related to "IsSortColumns=false".


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@sc.openoffice.org
For additional commands, e-mail: dev-h...@sc.openoffice.org

Reply via email to