Skip to main content

Класс TableProtectionProperties

Класс TableProtectionProperties предназначен для настройки параметров защиты листа в табличном документе (аналог раздела «Разрешенные действия» в меню «Управление защитой»). Данный класс используется в методах Table::setProtection() и Table::getProtectionProperties().

ПолеЗначение по умолчаниюОписание
TableProtectionProperties.deleteColumnsfalseРазрешить удалять колонки
TableProtectionProperties.deleteRowsfalseРазрешить удалять строки
TableProtectionProperties.filterDatafalseРазрешить фильтровать данные
TableProtectionProperties.formatCellsfalseРазрешить форматировать ячейки
TableProtectionProperties.formatColumnsfalseРазрешить форматировать столбцы
TableProtectionProperties.formatRowsfalseРазрешить форматировать строки
TableProtectionProperties.insertAndEditObjectsfalseРазрешить вставлять и редактировать объекты: изображения, диаграммы, фигуры и текстовые поля
TableProtectionProperties.insertAndEditPivotTablesfalseРазрешить вставлять и редактировать сводные таблицы
TableProtectionProperties.insertColumnsfalseРазрешить вставлять столбцы
TableProtectionProperties.insertLinksfalseРазрешить вставлять и редактировать ссылки в ячейках
TableProtectionProperties.insertRowsfalseРазрешить вставлять строки
TableProtectionProperties.selectProtectedCellstrueРазрешить выделение защищенных ячеек
TableProtectionProperties.sortDatafalseРазрешить сортировать данные

Пример​


TableProtectionProperties tableProps = TableProtectionProperties();
tableProps.deleteColumns = false;
tableProps.deleteRows = false;
tableProps.filterData = true;
tableProps.formatCells = true;
tableProps.formatColumns = true;
tableProps.formatRows = true;
tableProps.insertAndEditObjects = false;
tableProps.insertAndEditPivotTables = false;
tableProps.insertColumns = false;
tableProps.insertLinks = true;
tableProps.insertRows = false;
tableProps.selectProtectedCells = true;
tableProps.sortData = true;

Table firstSheet = document.getBlocks().getTable(0).get();
firstSheet.setProtection(tableProps, "password");