Class: OOXML::Excel::Sheet::DataValidation
- Inherits:
-
Object
- Object
- OOXML::Excel::Sheet::DataValidation
- Defined in:
- lib/ooxml_excel/sheet.rb
Instance Attribute Summary collapse
-
#allow_blank ⇒ Object
Returns the value of attribute allow_blank.
-
#formula ⇒ Object
Returns the value of attribute formula.
-
#prompt ⇒ Object
Returns the value of attribute prompt.
-
#sqref ⇒ Object
Returns the value of attribute sqref.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#allow_blank ⇒ Object
Returns the value of attribute allow_blank.
261 262 263 |
# File 'lib/ooxml_excel/sheet.rb', line 261 def allow_blank @allow_blank end |
#formula ⇒ Object
Returns the value of attribute formula.
261 262 263 |
# File 'lib/ooxml_excel/sheet.rb', line 261 def formula @formula end |
#prompt ⇒ Object
Returns the value of attribute prompt.
261 262 263 |
# File 'lib/ooxml_excel/sheet.rb', line 261 def prompt @prompt end |
#sqref ⇒ Object
Returns the value of attribute sqref.
261 262 263 |
# File 'lib/ooxml_excel/sheet.rb', line 261 def sqref @sqref end |
#type ⇒ Object
Returns the value of attribute type.
261 262 263 |
# File 'lib/ooxml_excel/sheet.rb', line 261 def type @type end |
Class Method Details
.load_from_node(data_validation_node) ⇒ Object
271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/ooxml_excel/sheet.rb', line 271 def self.load_from_node(data_validation_node) allow_blank = data_validation_node.attribute('allowBlank').try(:value) prompt = data_validation_node.attribute('prompt').try(:value) type = data_validation_node.attribute('type').try(:value) sqref = data_validation_node.attribute('sqref').try(:value) formula = data_validation_node.at('formula1').try(:content) self.new(allow_blank: allow_blank, prompt: prompt, type: type, sqref: sqref, formula: formula) end |
Instance Method Details
#in_sqref_range?(cell_id) ⇒ Boolean
263 264 265 266 267 268 269 |
# File 'lib/ooxml_excel/sheet.rb', line 263 def in_sqref_range?(cell_id) return if cell_id.blank? cell_letter = cell_id.gsub(/[\d]/, '') index = cell_id.gsub(/[^\d]/, '').to_i range = sqref_range.find { |single_cell_letter_or_range, row_range| single_cell_letter_or_range.is_a?(Range) ? single_cell_letter_or_range.cover?(cell_letter) : single_cell_letter_or_range == cell_letter} range.last.include?(index) if range.present? end |