Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
By default locked property is true and not specified in protection element
  • Loading branch information
Bykiev authored and tonyqus committed Aug 31, 2023
1 parent ce0e0cc commit c64e40b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions ooxml/XSSF/UserModel/XSSFCellStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,11 @@ public bool IsHidden
{
get
{
return _cellXf.IsSetProtection() && _cellXf.protection.IsSetHidden() && _cellXf.protection.hidden;
if (!_cellXf.IsSetProtection() || !_cellXf.protection.IsSetHidden())
{
return false;
}
return _cellXf.protection.hidden;
}
set
{
Expand Down Expand Up @@ -804,7 +808,7 @@ public bool IsLocked
{
if (!_cellXf.IsSetProtection())
{
return false;
return true;
}
return _cellXf.protection.locked;
}
Expand Down
2 changes: 1 addition & 1 deletion testcases/ooxml/XSSF/UserModel/TestXSSFCellStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ public void TestGetSetHidden()
[Test]
public void TestGetSetLocked()
{
Assert.IsFalse(cellStyle.IsLocked);
Assert.IsTrue(cellStyle.IsLocked);
cellStyle.IsLocked = (true);
Assert.IsTrue(cellStyle.IsLocked);
cellStyle.IsLocked = (false);
Expand Down

0 comments on commit c64e40b

Please sign in to comment.