Record Class SheetProtection

java.lang.Object
java.lang.Record
io.keikai.axyra.sheets.SheetProtection
Record Components:
selectLockedCells - users may select locked cells (default true)
selectUnlockedCells - users may select unlocked cells (default true)
formatCells - users may format cells (default false)
formatColumns - users may change column width and format (default false)
formatRows - users may change row height and format (default false)
insertColumns - users may insert columns (default false)
insertRows - users may insert rows (default false)
insertHyperlinks - users may insert hyperlinks (default false)
deleteColumns - users may delete columns (default false)
deleteRows - users may delete rows (default false)
sort - users may sort (default false)
autoFilter - users may use AutoFilter (default false)
pivotTables - users may use PivotTables (default false)
objects - users may edit objects such as shapes and charts (default false)
scenarios - users may edit what-if scenarios (default false)

public record SheetProtection(boolean selectLockedCells, boolean selectUnlockedCells, boolean formatCells, boolean formatColumns, boolean formatRows, boolean insertColumns, boolean insertRows, boolean insertHyperlinks, boolean deleteColumns, boolean deleteRows, boolean sort, boolean autoFilter, boolean pivotTables, boolean objects, boolean scenarios) extends Record
Sheet protection options — the checkboxes of Excel's "Protect Sheet" dialog. Every flag uses allow semantics: true means users may perform the action while the sheet is protected.

The on-disk ECMA-376 §18.3.1.85 <sheetProtection> attributes use the inverse locked semantics (e.g. attribute formatCells="1" means formatting is prevented); the engine performs the inversion.

defaults() mirrors Excel's dialog defaults: only selecting locked and unlocked cells is allowed. Build other options with builder():


 SheetProtection p = SheetProtection.builder().sort(true).autoFilter(true).build();
 
  • Constructor Details

    • SheetProtection

      public SheetProtection(boolean selectLockedCells, boolean selectUnlockedCells, boolean formatCells, boolean formatColumns, boolean formatRows, boolean insertColumns, boolean insertRows, boolean insertHyperlinks, boolean deleteColumns, boolean deleteRows, boolean sort, boolean autoFilter, boolean pivotTables, boolean objects, boolean scenarios)
      Creates an instance of a SheetProtection record class.
      Parameters:
      selectLockedCells - the value for the selectLockedCells record component
      selectUnlockedCells - the value for the selectUnlockedCells record component
      formatCells - the value for the formatCells record component
      formatColumns - the value for the formatColumns record component
      formatRows - the value for the formatRows record component
      insertColumns - the value for the insertColumns record component
      insertRows - the value for the insertRows record component
      insertHyperlinks - the value for the insertHyperlinks record component
      deleteColumns - the value for the deleteColumns record component
      deleteRows - the value for the deleteRows record component
      sort - the value for the sort record component
      autoFilter - the value for the autoFilter record component
      pivotTables - the value for the pivotTables record component
      objects - the value for the objects record component
      scenarios - the value for the scenarios record component
  • Method Details

    • defaults

      public static SheetProtection defaults()
      Returns Excel's Protect Sheet dialog defaults: only cell selection is allowed.
    • builder

      public static SheetProtection.Builder builder()
      Returns a new builder holding defaults().
    • toBuilder

      public SheetProtection.Builder toBuilder()
      Returns a new builder holding this value's flags, to derive a changed copy.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • selectLockedCells

      public boolean selectLockedCells()
      Returns the value of the selectLockedCells record component.
      Returns:
      the value of the selectLockedCells record component
    • selectUnlockedCells

      public boolean selectUnlockedCells()
      Returns the value of the selectUnlockedCells record component.
      Returns:
      the value of the selectUnlockedCells record component
    • formatCells

      public boolean formatCells()
      Returns the value of the formatCells record component.
      Returns:
      the value of the formatCells record component
    • formatColumns

      public boolean formatColumns()
      Returns the value of the formatColumns record component.
      Returns:
      the value of the formatColumns record component
    • formatRows

      public boolean formatRows()
      Returns the value of the formatRows record component.
      Returns:
      the value of the formatRows record component
    • insertColumns

      public boolean insertColumns()
      Returns the value of the insertColumns record component.
      Returns:
      the value of the insertColumns record component
    • insertRows

      public boolean insertRows()
      Returns the value of the insertRows record component.
      Returns:
      the value of the insertRows record component
    • insertHyperlinks

      public boolean insertHyperlinks()
      Returns the value of the insertHyperlinks record component.
      Returns:
      the value of the insertHyperlinks record component
    • deleteColumns

      public boolean deleteColumns()
      Returns the value of the deleteColumns record component.
      Returns:
      the value of the deleteColumns record component
    • deleteRows

      public boolean deleteRows()
      Returns the value of the deleteRows record component.
      Returns:
      the value of the deleteRows record component
    • sort

      public boolean sort()
      Returns the value of the sort record component.
      Returns:
      the value of the sort record component
    • autoFilter

      public boolean autoFilter()
      Returns the value of the autoFilter record component.
      Returns:
      the value of the autoFilter record component
    • pivotTables

      public boolean pivotTables()
      Returns the value of the pivotTables record component.
      Returns:
      the value of the pivotTables record component
    • objects

      public boolean objects()
      Returns the value of the objects record component.
      Returns:
      the value of the objects record component
    • scenarios

      public boolean scenarios()
      Returns the value of the scenarios record component.
      Returns:
      the value of the scenarios record component