Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of SortState for Table #1838

Open
doracpphp opened this issue Mar 5, 2024 · 1 comment
Open

Addition of SortState for Table #1838

doracpphp opened this issue Mar 5, 2024 · 1 comment

Comments

@doracpphp
Copy link

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.):

@Blogoslov
Copy link

I'm also interesting in method how to apply necessary soring on the columns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants