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_string(str = '') ⇒ String
Serializes the object.
Constructor Details
#initialize(options = {}) ⇒ CellProtection
Creates a new CellProtection
19 20 21 22 23 |
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 19 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
10 11 12 |
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 10 def hidden @hidden end |
#locked ⇒ Boolean
specifies if the cells that have the style containing this protection
14 15 16 |
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 14 def locked @locked end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
33 34 35 36 37 |
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 33 def to_xml_string(str = '') str << '<protection ' str << instance_values.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ') str << '/>' end |