Class: Axlsx::CellProtection
- Inherits:
-
Object
- Object
- Axlsx::CellProtection
- 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.
Instance Attribute Summary collapse
-
#hidden ⇒ Boolean
specifies locking for cells that have the style containing this protection.
-
#locked ⇒ Boolean
specifies if the cells that have the style containing this protection.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CellProtection
constructor
Creates a new CellProtection.
-
#to_xml(xml) ⇒ String
Serializes the cell protection.
Constructor Details
#initialize(options = {}) ⇒ CellProtection
Creates a new CellProtection
18 19 20 21 22 |
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 18 def initialize(={}) .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end |
Instance Attribute Details
#hidden ⇒ Boolean
specifies locking for cells that have the style containing this protection
9 10 11 |
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 9 def hidden @hidden end |
#locked ⇒ Boolean
specifies if the cells that have the style containing this protection
13 14 15 |
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 13 def locked @locked end |
Instance Method Details
#to_xml(xml) ⇒ String
Serializes the cell protection
29 30 31 |
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 29 def to_xml(xml) xml.protection(self.instance_values) end |