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

--- Comment #2 from [email protected] ---
Reproduced, but only when the data block is text-only.

Steps (26.8.1.1 and master, Windows):
1. New document; A1:B6 all text: Name/City, Zoe/Sydney, Adam/Perth, Mia/Hobart,
Ben/Darwin, Lily/Cairns.
2. Select A1, Data > More Filters > Standard Filter. Under Options tick "Range
contains column labels" (the field list then shows Name/City). Name = Not
Empty, OK.
3. Select A3, Data > Sort Ascending.

Result: the header row Name/City is sorted into row 5. Freezing the first row
is not needed; I get the same without it.

Controls:
- Data > Sort... dialog right after step 2: "Range contains column labels" is
checked, key 1 = Name, and the header stays in row 1.
- After one Sort Ascending + Undo, the Sort dialog shows that option unchecked,
so the quick sort seems to overwrite the range's header setting.
- If row 2 contains a number (Name/Score), the header stays in row 1. My first
attempt used such data, which is why I did not see it then.
- Data > AutoFilter instead of Standard Filter, then Sort Ascending: header
sorted into row 5 in 26.8.1.1, kept in row 1 in master (probably commit
17a184f8b40d, "detect and don't include filter / pivot headers into calc
sorting", see bug 148293).

Code pointer: for SID_SORT_ASCENDING/DESCENDING, sc/source/ui/view/cellsh2.cxx
sets aSortParam.bHasHeader = rDoc.HasColHeader(...) unconditionally.
ScTable::HasColHeader() (table3.cxx) returns false when row 1 and row 2 are
both text, so the "contains column labels" flag of the database range is
ignored. The Sort dialog path only overrides the flag when a header is
detected.

This looks like a duplicate of bug 148679 ("Database range (and its column
labels / totals settings) is not considered when expanding the range for
sorting").

LibreOffice:
Version: 26.8.1.1 (X86_64)
Build ID: bf6ef2662401c7d6dce671ab4deb26ee0af3a7c1
CPU threads: 20; OS: Windows 11 X86_64 (build 26200); UI render: Skia/Raster;
VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: CL threaded

LibreOfficeDev:
Version: 27.2.0.0.alpha0+ (X86_64)
Build ID: 70e6dd0eb1874f0c5e260948b2c8b9e192841372
CPU threads: 20; OS: Windows 11 X86_64 (build 26200); UI render: Skia/Raster;
VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: CL threaded

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to