Class: OoxmlParser::DataValidation
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DataValidation
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb
Overview
Class for ‘dataValidation` data
Instance Attribute Summary collapse
-
#allow_blank ⇒ Boolean
readonly
Should blank entries be valid.
-
#error ⇒ String
readonly
Specifies the message text of the error alert.
-
#error_style ⇒ Symbol
readonly
Type of error.
-
#error_title ⇒ String
readonly
The text of the title bar of the error alert.
-
#formula1 ⇒ DataValidationFormula
readonly
First formula of data validation.
-
#formula2 ⇒ DataValidationFormula
readonly
Second formula of data validation.
-
#ime_mode ⇒ Symbol
readonly
Input Method Editor (IME) mode.
-
#operator ⇒ Symbol
readonly
Relational operator used with this data validation.
-
#prompt ⇒ String
readonly
Message text of the input prompt.
-
#prompt_title ⇒ String
readonly
Text of the title bar of the input prompt.
-
#reference_sequence ⇒ String
readonly
Ranges to which data validation is applied.
-
#show_dropdown ⇒ Symbol
readonly
Specifies whether to display the drop-down combo box.
-
#show_error_message ⇒ Symbol
readonly
Specifies whether to display error alert message.
-
#show_input_message ⇒ Symbol
readonly
Specifies whether to display the input prompt.
-
#type ⇒ Symbol
readonly
Type of validation.
-
#uid ⇒ String
readonly
UID of validation.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ DataValidation
Parse DataValidation data.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#allow_blank ⇒ Boolean (readonly)
Returns should blank entries be valid.
8 9 10 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 8 def allow_blank @allow_blank end |
#error ⇒ String (readonly)
Returns Specifies the message text of the error alert.
10 11 12 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 10 def error @error end |
#error_style ⇒ Symbol (readonly)
Returns Type of error.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 12 def error_style @error_style end |
#error_title ⇒ String (readonly)
Returns The text of the title bar of the error alert.
14 15 16 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 14 def error_title @error_title end |
#formula1 ⇒ DataValidationFormula (readonly)
Returns first formula of data validation.
16 17 18 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 16 def formula1 @formula1 end |
#formula2 ⇒ DataValidationFormula (readonly)
Returns second formula of data validation.
18 19 20 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 18 def formula2 @formula2 end |
#ime_mode ⇒ Symbol (readonly)
Returns Input Method Editor (IME) mode.
20 21 22 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 20 def ime_mode @ime_mode end |
#operator ⇒ Symbol (readonly)
Returns Relational operator used with this data validation.
22 23 24 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 22 def operator @operator end |
#prompt ⇒ String (readonly)
Returns Message text of the input prompt.
24 25 26 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 24 def prompt @prompt end |
#prompt_title ⇒ String (readonly)
Returns Text of the title bar of the input prompt.
26 27 28 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 26 def prompt_title @prompt_title end |
#reference_sequence ⇒ String (readonly)
Returns Ranges to which data validation is applied.
28 29 30 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 28 def reference_sequence @reference_sequence end |
#show_dropdown ⇒ Symbol (readonly)
Returns Specifies whether to display the drop-down combo box.
30 31 32 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 30 def show_dropdown @show_dropdown end |
#show_error_message ⇒ Symbol (readonly)
Returns Specifies whether to display error alert message.
34 35 36 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 34 def @show_error_message end |
#show_input_message ⇒ Symbol (readonly)
Returns Specifies whether to display the input prompt.
32 33 34 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 32 def @show_input_message end |
#type ⇒ Symbol (readonly)
Returns Type of validation.
36 37 38 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 36 def type @type end |
#uid ⇒ String (readonly)
Returns UID of validation.
38 39 40 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 38 def uid @uid end |
Instance Method Details
#parse(node) ⇒ DataValidation
Parse DataValidation data
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb', line 43 def parse(node) node.attributes.each do |key, value| case key when 'allowBlank' @allow_blank = attribute_enabled?(value) when 'error' @error = value.value.to_s when 'errorStyle' @error_style = value.value.to_sym when 'errorTitle' @error_title = value.value.to_s when 'imeMode' @ime_mode = value.value.to_sym when 'operator' @operator = value.value.to_sym when 'type' @type = value.value.to_sym when 'prompt' @prompt = value.value.to_s when 'promptTitle' @prompt_title = value.value.to_s when 'showDropDown' @show_dropdown = attribute_enabled?(value) when 'showInputMessage' @show_input_message = attribute_enabled?(value) when 'showErrorMessage' @show_error_message = attribute_enabled?(value) when 'uid' @uid = value.value.to_s end end node.xpath('*').each do |node_child| case node_child.name when 'formula1' @formula1 = DataValidationFormula.new(parent: self).parse(node_child) when 'formula2' @formula2 = DataValidationFormula.new(parent: self).parse(node_child) when 'sqref' @reference_sequence = node_child.text end end self end |