Sha256: 969b5d61be3d5d4f0b5ce090f5c8c72df747b6f7aceb279e3e8d7187a0b14cc7

Contents?: true

Size: 1.22 KB

Versions: 14

Compression:

Stored size: 1.22 KB

Contents

# encoding: UTF-8
module Axlsx
  # CellProtection stores information about locking or hiding cells in spreadsheet.
  # @note Using Styles#add_style is the recommended way to manage cell protection.
  # @see Styles#add_style
  class CellProtection

    # specifies locking for cells that have the style containing this protection
    # @return [Boolean]
    attr_reader :hidden

    # specifies if the cells that have the style containing this protection
    # @return [Boolean]
    attr_reader :locked

    # Creates a new CellProtection
    # @option options [Boolean] hidden value for hidden protection
    # @option options [Boolean] locked value for locked protection
    def initialize(options={})
      options.each do |o|
        self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      end
    end

    # @see hidden
    def hidden=(v) Axlsx::validate_boolean v; @hidden = v end
    # @see locked
    def locked=(v) Axlsx::validate_boolean v; @locked = v end

    # Serializes the object
    # @param [String] str
    # @return [String]
    def to_xml_string(str = '')
      str << '<protection '
      str << instance_values.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ')
      str << '/>'
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
axlsx-1.3.1 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.2.3 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.2.2 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.2.1 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.2.0 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.1.8 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.1.7 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.1.6 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.1.5 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.1.4 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.1.3 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.1.2 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.1.1 lib/axlsx/stylesheet/cell_protection.rb
axlsx-1.1.0 lib/axlsx/stylesheet/cell_protection.rb