diff --git a/ooxml/XSSF/UserModel/XSSFCellStyle.cs b/ooxml/XSSF/UserModel/XSSFCellStyle.cs index a51d634e4..e393f89ae 100644 --- a/ooxml/XSSF/UserModel/XSSFCellStyle.cs +++ b/ooxml/XSSF/UserModel/XSSFCellStyle.cs @@ -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 { @@ -804,7 +808,7 @@ public bool IsLocked { if (!_cellXf.IsSetProtection()) { - return false; + return true; } return _cellXf.protection.locked; } diff --git a/testcases/ooxml/XSSF/UserModel/TestXSSFCellStyle.cs b/testcases/ooxml/XSSF/UserModel/TestXSSFCellStyle.cs index 8de136aa9..f140e5d4a 100644 --- a/testcases/ooxml/XSSF/UserModel/TestXSSFCellStyle.cs +++ b/testcases/ooxml/XSSF/UserModel/TestXSSFCellStyle.cs @@ -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);