Class: Axlsx::CellProtection

Inherits:
Object
  • Object
show all
Includes:
OptionsParser, SerializedAttributes
Defined in:
lib/axlsx/stylesheet/cell_protection.rb

Overview

Note:

Using Styles#add_style is the recommended way to manage cell protection.

CellProtection stores information about locking or hiding cells in spreadsheet.

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SerializedAttributes

#declared_attributes, included, #serialized_attributes, #serialized_element_attributes, #serialized_tag

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(options = {}) ⇒ CellProtection

Creates a new CellProtection

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • hidden (Boolean)

    value for hidden protection

  • locked (Boolean)

    value for locked protection



24
25
26
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 24

def initialize(options={})
  parse_options options
end

Instance Attribute Details

#hiddenBoolean

specifies locking for cells that have the style containing this protection

Returns:

  • (Boolean)


15
16
17
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 15

def hidden
  @hidden
end

#lockedBoolean

specifies if the cells that have the style containing this protection

Returns:

  • (Boolean)


19
20
21
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 19

def locked
  @locked
end

Instance Method Details

#to_xml_string(str = '') ⇒ String

Serializes the object

Parameters:

  • str (String) (defaults to: '')

Returns:



36
37
38
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 36

def to_xml_string(str = '')
  serialized_tag('protection', str)
end