blob: 64a5795cc8ee333fdb65f574c70ca62b8d1b0d0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# frozen_string_literal: true
module Axlsx
# The Protected Range class represents a set of cells in the worksheet
# @note the recommended way to manage protected ranges with via Worksheet#protect_range
# @see Worksheet#protect_range
class ProtectedRange
include Axlsx::OptionsParser
include Axlsx::SerializedAttributes
# Initializes a new protected range object
# @option [String] sqref The cell range reference to protect. This can be an absolute or a relateve range however, it only applies to the current sheet.
# @option [String] name An optional name for the protected name.
def initialize(options = {})
parse_options options
yield self if block_given?
end
serializable_attributes :sqref, :name
# The reference for the protected range
# @return [String]
attr_reader :sqref
# The name of the protected range
# @return [String]
attr_reader :name
# @see sqref
def sqref=(v)
Axlsx.validate_string(v)
@sqref = v
end
# @see name
def name=(v)
Axlsx.validate_string(v)
@name = v
end
# serializes the proteted range
# @param [String] str if this string object is provided we append
# our output to that object. Use this - it helps limit the number of
# objects created during serialization
def to_xml_string(str = +'')
serialized_tag 'protectedRange', str
end
end
end
|