Ejemplo n.º 1
0
        public void TestWriteSelectEnableLocking()
        {
            sheet = (XSSFSheet)XSSFTestDataSamples.OpenSampleWorkbook("sheetProtection_allLocked.xlsx").GetSheetAt(0);

            Assert.IsTrue(sheet.IsAutoFilterLocked);
            Assert.IsTrue(sheet.IsDeleteColumnsLocked);
            Assert.IsTrue(sheet.IsDeleteRowsLocked);
            Assert.IsTrue(sheet.IsFormatCellsLocked);
            Assert.IsTrue(sheet.IsFormatColumnsLocked);
            Assert.IsTrue(sheet.IsFormatRowsLocked);
            Assert.IsTrue(sheet.IsInsertColumnsLocked);
            Assert.IsTrue(sheet.IsInsertHyperlinksLocked);
            Assert.IsTrue(sheet.IsInsertRowsLocked);
            Assert.IsTrue(sheet.IsPivotTablesLocked);
            Assert.IsTrue(sheet.IsSortLocked);
            Assert.IsTrue(sheet.IsObjectsLocked);
            Assert.IsTrue(sheet.IsScenariosLocked);
            Assert.IsTrue(sheet.IsSelectLockedCellsLocked);
            Assert.IsTrue(sheet.IsSelectUnlockedCellsLocked);
            Assert.IsTrue(sheet.IsSheetLocked);

            sheet.DisableLocking();

            Assert.IsFalse(sheet.IsAutoFilterLocked);
            Assert.IsFalse(sheet.IsDeleteColumnsLocked);
            Assert.IsFalse(sheet.IsDeleteRowsLocked);
            Assert.IsFalse(sheet.IsFormatCellsLocked);
            Assert.IsFalse(sheet.IsFormatColumnsLocked);
            Assert.IsFalse(sheet.IsFormatRowsLocked);
            Assert.IsFalse(sheet.IsInsertColumnsLocked);
            Assert.IsFalse(sheet.IsInsertHyperlinksLocked);
            Assert.IsFalse(sheet.IsInsertRowsLocked);
            Assert.IsFalse(sheet.IsPivotTablesLocked);
            Assert.IsFalse(sheet.IsSortLocked);
            Assert.IsFalse(sheet.IsObjectsLocked);
            Assert.IsFalse(sheet.IsScenariosLocked);
            Assert.IsFalse(sheet.IsSelectLockedCellsLocked);
            Assert.IsFalse(sheet.IsSelectUnlockedCellsLocked);
            Assert.IsFalse(sheet.IsSheetLocked);
        }