Class: Axlsx::ProtectedRange

Inherits:
Object
  • Object
show all
Includes:
OptionsParser, SerializedAttributes
Defined in:
lib/axlsx/workbook/worksheet/protected_range.rb

Overview

Note:

the recommended way to manage protected ranges with via Worksheet#protect_range

The Protected Range class represents a set of cells in the worksheet

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SerializedAttributes

#declared_attributes, included, #serialized_attributes, #serialized_element_attributes

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ ProtectedRange

Returns a new instance of ProtectedRange.

Parameters:

  • [String] (Hash)

    a customizable set of options

Yields:

  • (_self)

Yield Parameters:



13
14
15
16
# File 'lib/axlsx/workbook/worksheet/protected_range.rb', line 13

def initialize(options={})
  parse_options options
  yield self if block_given?
end

Instance Attribute Details

#nameString

The name of the protected range

Returns:

  • (String)


25
26
27
# File 'lib/axlsx/workbook/worksheet/protected_range.rb', line 25

def name
  @name
end

#sqrefString

The reference for the protected range

Returns:

  • (String)


21
22
23
# File 'lib/axlsx/workbook/worksheet/protected_range.rb', line 21

def sqref
  @sqref
end

Instance Method Details

#to_xml_string(str = "") ⇒ Object

serializes the proteted range our output to that object. Use this - it helps limit the number of objects created during serialization

Parameters:

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

    if this string object is provided we append



43
44
45
46
47
# File 'lib/axlsx/workbook/worksheet/protected_range.rb', line 43

def to_xml_string(str="")
  str << '<protectedRange '
  serialized_attributes str
  str << '/>'
end