Skip to content

Addition of SortState for Table #1838

@doracpphp

Description

@doracpphp

Description

I would like to sort the elements of a Table using Excel's sort function.
Currently, I have implemented SortState and sortCondition in Table.
On first startup, the ascending and descending marks appear, but the elements are not sorted.

Steps to reproduce the issue:

  1. It generates xml like this
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="1"
    name="Table1" displayName="Table1" ref="A1:B6">
    <autoFilter ref="A1:B6"></autoFilter>
    <sortState ref="A2:B6"
        xmlns:xlrd2="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata2">
        <sortCondition descending="1" ref="A1:A6"></sortCondition>
    </sortState>
    <tableColumns count="2">
        <tableColumn id="1" name="id"></tableColumn>
        <tableColumn id="2" name="name"></tableColumn>
    </tableColumns>
    <tableStyleInfo name="TableStyleMedium2" showFirstColumn="false" showLastColumn="false"
        showRowStripes="true" showColumnStripes="false"></tableStyleInfo>
</table>
  1. This is the screen when Excel is opened
    They are supposed to be lined up in descending order, but they are not.

image

Describe the results you expected:

Excel files are sorted and displayed when opened
If anyone knows how to do this, could you please advise?

Output of go version:

go version go1.21.6 windows/amd64

Excelize version or commit ID:

f20bbd1f1dcb44eeaf60ed2f5bdc1ac77000a930

Environment details (OS, Microsoft Excel™ version, physical, etc.):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions