Bug 144097 - FILEOPEN generated XLSX: Inconsistent handling of protection in the presence of fonts
Summary: FILEOPEN generated XLSX: Inconsistent handling of protection in the presence ...
Status: RESOLVED DUPLICATE of bug 123139
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.0.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Cell-Sheet-Protection XLSX-External-Generators
  Show dependency treegraph
 
Reported: 2021-08-26 07:40 UTC by SheetJS
Modified: 2024-03-21 13:00 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
"bad.xlsx" file exhibiting issue (14.16 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2021-08-26 07:41 UTC, SheetJS
Details
"good.xlsx" with manual applyProtection="1 (14.17 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2021-08-26 07:42 UTC, SheetJS
Details
Sample compared in MSO and LO (28.67 KB, image/png)
2021-08-26 14:19 UTC, Timur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description SheetJS 2021-08-26 07:40:42 UTC
Description:
LO does not apply cell protection properties when reading XLSX files with fonts

Steps to Reproduce:
Open attached "bad.xlsx" and try to edit cell C1

Actual Results:
C1 is not editable and LO shows a popup

Expected Results:
C1 is editable (tested against Excel 2019)


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Cells B1 and B2 are editable in `bad.xlsx`.  They use the following XF:

```
    <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1">
      <alignment wrapText="true"/>
      <protection hidden="0" locked="0"/>
    </xf>
```

Cells C1 and C2 are not editable in `bad.xlsx` even though they should be.  They use the following XF:

```
    <xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyNumberFormat="1" applyFont="1">
      <alignment wrapText="true"/>
      <protection hidden="0" locked="0"/>
    </xf>
```

The presence of `applyFont="1"` is somehow changing LO's parse of the style, since LO does the right thing for B1/B2 but not for C1/C2.

The `good.xlsx` attachment was generated by manually adding `applyProtection="1"` and that seems to resolve matters.  It seems LO assumes the default for applyProtection depends on whether `applyFont` is passed.  The correct behavior (comparing with Excel) is to assume applyProtection is true if there is a protection child element.
Comment 1 SheetJS 2021-08-26 07:41:34 UTC
Created attachment 174548 [details]
"bad.xlsx" file exhibiting issue
Comment 2 SheetJS 2021-08-26 07:42:30 UTC
Created attachment 174549 [details]
"good.xlsx" with manual applyProtection="1
Comment 3 Timur 2021-08-26 14:19:15 UTC
Created attachment 174557 [details]
Sample compared in MSO and LO

Repro 7.3+.
Comment 4 Justin L 2024-03-21 13:00:29 UTC
Fixed in LO 7.4 with commit ab99d16e21e56596803b7d9a28af0895b435ef3e
Author: Justin Luth on Tue Nov 30 15:15:24 2021 +0200
    tdf#123139 sc oox: CellXf should default to applyAlignment
    
    Since the same logic applied to applyProtection
    I tested and changed that one too.

*** This bug has been marked as a duplicate of bug 123139 ***