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: NEW
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
  Show dependency treegraph
 
Reported: 2021-08-26 07:40 UTC by SheetJS
Modified: 2021-08-26 14:19 UTC (History)
0 users

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+.