ooxml_parser 0.12.2 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +0 -6
- data/lib/ooxml_parser/version.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +5 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations.rb +47 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb +88 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation/data_validation_formula.rb +22 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8d43b880b2291d11e75cf1107c546077d36d4123044cf71d0b85a5f7a62487b
|
4
|
+
data.tar.gz: 6690b7dad0c09b17ac772af66a6f614a8e68331c6ddb247597cf818887e4b16e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6c51d4331048c7250d9724da8c00354d235df4dbe8fad57cc81783133a4d0a030ce02056000afb4a5f5d13a91e4f8f28ce51d82f4d581b55da6902fe2927f1a
|
7
|
+
data.tar.gz: abc21e3b8151d29985cdb96a05e60eef69feb949fc6b12f24c225ba050d08ad021de39745250dbdef4920965dcca430473d0b3f089c4ca122ea790a612026ecc
|
@@ -269,11 +269,5 @@ module OoxmlParser
|
|
269
269
|
nil
|
270
270
|
end
|
271
271
|
deprecate :sdt, 'nonempty_runs[i]', 2020, 1
|
272
|
-
|
273
|
-
# @return [OoxmlParser::FrameProperties] Return frame properties
|
274
|
-
def frame_properties
|
275
|
-
paragraph_properties.frame_properties
|
276
|
-
end
|
277
|
-
deprecate :frame_properties, 'paragraph_properties.frame_properties', 2020, 1
|
278
272
|
end
|
279
273
|
end
|
data/lib/ooxml_parser/version.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'extension/data_validations'
|
3
4
|
require_relative 'extension/sparkline_groups'
|
4
5
|
require_relative 'extension/x14_table'
|
5
6
|
module OoxmlParser
|
6
7
|
# Class for `ext` data
|
7
8
|
class Extension < OOXMLDocumentObject
|
9
|
+
# @return [DataValidations] list of data validations
|
10
|
+
attr_accessor :data_validations
|
8
11
|
# @return [X14Table] table data in x14 namespace
|
9
12
|
attr_accessor :table
|
10
13
|
# @return [SparklineGroups] list of groups
|
@@ -16,6 +19,8 @@ module OoxmlParser
|
|
16
19
|
def parse(node)
|
17
20
|
node.xpath('*').each do |column_node|
|
18
21
|
case column_node.name
|
22
|
+
when 'dataValidations'
|
23
|
+
@data_validations = DataValidations.new(parent: self).parse(column_node)
|
19
24
|
when 'table'
|
20
25
|
@table = X14Table.new(parent: self).parse(column_node)
|
21
26
|
when 'sparklineGroups'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'data_validations/data_validation'
|
4
|
+
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for `dataValidations` data
|
7
|
+
class DataValidations < OOXMLDocumentObject
|
8
|
+
# @return [Integer] count of validations
|
9
|
+
attr_reader :count
|
10
|
+
# @return [Array<DataValidation>] list of data validations
|
11
|
+
attr_reader :data_validations
|
12
|
+
# @return [Boolean] is prompts disabled
|
13
|
+
attr_reader :disable_prompts
|
14
|
+
|
15
|
+
def initialize(parent: nil)
|
16
|
+
@data_validations = []
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [SparklineGroup] accessor
|
21
|
+
def [](key)
|
22
|
+
data_validations[key]
|
23
|
+
end
|
24
|
+
|
25
|
+
# Parse DataValidations data
|
26
|
+
# @param [Nokogiri::XML:Element] node with DataValidations data
|
27
|
+
# @return [DataValidations] value of DataValidations data
|
28
|
+
def parse(node)
|
29
|
+
node.attributes.each do |key, value|
|
30
|
+
case key
|
31
|
+
when 'count'
|
32
|
+
@count = value.value.to_i
|
33
|
+
when 'disablePrompts'
|
34
|
+
@disable_prompts = attribute_enabled?(value)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
node.xpath('*').each do |node_child|
|
39
|
+
case node_child.name
|
40
|
+
when 'dataValidation'
|
41
|
+
@data_validations << DataValidation.new(parent: self).parse(node_child)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
self
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'data_validation/data_validation_formula'
|
4
|
+
module OoxmlParser
|
5
|
+
# Class for `dataValidation` data
|
6
|
+
class DataValidation < OOXMLDocumentObject
|
7
|
+
# @return [Boolean] should blank entries be valid
|
8
|
+
attr_reader :allow_blank
|
9
|
+
# @return [String] Specifies the message text of the error alert
|
10
|
+
attr_reader :error
|
11
|
+
# @return [Symbol] Type of error
|
12
|
+
attr_reader :error_style
|
13
|
+
# @return [String] The text of the title bar of the error alert
|
14
|
+
attr_reader :error_title
|
15
|
+
# @return [DataValidationFormula] first formula of data validation
|
16
|
+
attr_reader :formula1
|
17
|
+
# @return [DataValidationFormula] second formula of data validation
|
18
|
+
attr_reader :formula2
|
19
|
+
# @return [Symbol] Input Method Editor (IME) mode
|
20
|
+
attr_reader :ime_mode
|
21
|
+
# @return [Symbol] Relational operator used with this data validation
|
22
|
+
attr_reader :operator
|
23
|
+
# @return [String] Message text of the input prompt
|
24
|
+
attr_reader :prompt
|
25
|
+
# @return [String] Text of the title bar of the input prompt
|
26
|
+
attr_reader :prompt_title
|
27
|
+
# @return [String] Ranges to which data validation is applied
|
28
|
+
attr_reader :reference_sequence
|
29
|
+
# @return [Symbol] Specifies whether to display the drop-down combo box
|
30
|
+
attr_reader :show_dropdown
|
31
|
+
# @return [Symbol] Specifies whether to display the input prompt
|
32
|
+
attr_reader :show_input_message
|
33
|
+
# @return [Symbol] Specifies whether to display error alert message
|
34
|
+
attr_reader :show_error_message
|
35
|
+
# @return [Symbol] Type of validation
|
36
|
+
attr_reader :type
|
37
|
+
# @return [String] UID of validation
|
38
|
+
attr_reader :uid
|
39
|
+
|
40
|
+
# Parse DataValidation data
|
41
|
+
# @param [Nokogiri::XML:Element] node with DataValidation data
|
42
|
+
# @return [DataValidation] value of DataValidation data
|
43
|
+
def parse(node)
|
44
|
+
node.attributes.each do |key, value|
|
45
|
+
case key
|
46
|
+
when 'allowBlank'
|
47
|
+
@allow_blank = attribute_enabled?(value)
|
48
|
+
when 'error'
|
49
|
+
@error = value.value.to_s
|
50
|
+
when 'errorStyle'
|
51
|
+
@error_style = value.value.to_sym
|
52
|
+
when 'errorTitle'
|
53
|
+
@error_title = value.value.to_s
|
54
|
+
when 'imeMode'
|
55
|
+
@ime_mode = value.value.to_sym
|
56
|
+
when 'operator'
|
57
|
+
@operator = value.value.to_sym
|
58
|
+
when 'type'
|
59
|
+
@type = value.value.to_sym
|
60
|
+
when 'prompt'
|
61
|
+
@prompt = value.value.to_s
|
62
|
+
when 'promptTitle'
|
63
|
+
@prompt_title = value.value.to_s
|
64
|
+
when 'showDropDown'
|
65
|
+
@show_dropdown = attribute_enabled?(value)
|
66
|
+
when 'showInputMessage'
|
67
|
+
@show_input_message = attribute_enabled?(value)
|
68
|
+
when 'showErrorMessage'
|
69
|
+
@show_error_message = attribute_enabled?(value)
|
70
|
+
when 'uid'
|
71
|
+
@uid = value.value.to_s
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
node.xpath('*').each do |node_child|
|
76
|
+
case node_child.name
|
77
|
+
when 'formula1'
|
78
|
+
@formula1 = DataValidationFormula.new(parent: self).parse(node_child)
|
79
|
+
when 'formula2'
|
80
|
+
@formula2 = DataValidationFormula.new(parent: self).parse(node_child)
|
81
|
+
when 'sqref'
|
82
|
+
@reference_sequence = node_child.text
|
83
|
+
end
|
84
|
+
end
|
85
|
+
self
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for `x14:formula1` or `x14:formula2` data
|
5
|
+
class DataValidationFormula < OOXMLDocumentObject
|
6
|
+
# @return [Formula] value of formula
|
7
|
+
attr_reader :formula
|
8
|
+
|
9
|
+
# Parse DataValidationFormula data
|
10
|
+
# @param [Nokogiri::XML:Element] node with DataValidationFormula data
|
11
|
+
# @return [DataValidationFormula] value of DataValidationFormula data
|
12
|
+
def parse(node)
|
13
|
+
node.xpath('*').each do |node_child|
|
14
|
+
case node_child.name
|
15
|
+
when 'f'
|
16
|
+
@formula = Formula.new(parent: self).parse(node_child)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ooxml_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ONLYOFFICE
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-05-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -535,6 +535,9 @@ files:
|
|
535
535
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters/custom_filter.rb
|
536
536
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb
|
537
537
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb
|
538
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations.rb
|
539
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb
|
540
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation/data_validation_formula.rb
|
538
541
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb
|
539
542
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group.rb
|
540
543
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb
|
@@ -573,7 +576,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
573
576
|
- !ruby/object:Gem::Version
|
574
577
|
version: '0'
|
575
578
|
requirements: []
|
576
|
-
rubygems_version: 3.
|
579
|
+
rubygems_version: 3.1.6
|
577
580
|
signing_key:
|
578
581
|
specification_version: 4
|
579
582
|
summary: OoxmlParser Gem
|