ooxml_parser 0.9.1 → 0.12.2
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.rb +5 -9
- data/lib/ooxml_parser/common_parser/common_data/content_types.rb +7 -0
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +10 -3
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +13 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_stlye_ref.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +4 -8
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +4 -8
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_helper.rb +7 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +3 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +8 -4
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +1 -3
- data/lib/ooxml_parser/version.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +17 -3
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb +6 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field/shared_items.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition.rb +114 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items/column_row_item.rb +22 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/location.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items/item.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_table_style_info.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +1 -1
- metadata +112 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36954aec83ece68abe869fbdacc1eb46f3324ca2220fa1309480ac58c1d7a30e
|
4
|
+
data.tar.gz: aa146d19ad2d1791d435be68b2d13bf4f601fbea14856cd880c292c269d3fc77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d024e15631968da836ad38f32316f52eb87a9aa924cbb7240ea445162679799ce4cfc85183122e07fdc8a501b34efde6a6c3d38d179b7fd7ee12fd5e17a95693
|
7
|
+
data.tar.gz: e97ac2cff7f7db1f93e79bff2b7110db0c78a748f396337ac851369c799001eb9779762324dfa7c177a9583905cd435db2ba507caab7faf41a5a980e66a0f31c
|
@@ -94,13 +94,9 @@ module OoxmlParser
|
|
94
94
|
# @return [True, False] result of comparision
|
95
95
|
def ==(other)
|
96
96
|
if other.is_a?(Color)
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
true
|
101
|
-
else
|
102
|
-
false
|
103
|
-
end
|
97
|
+
((@red == other.red) && (@green == other.green) && (@blue == other.blue)) ||
|
98
|
+
(none? && other.white?) ||
|
99
|
+
(white? && other.none?)
|
104
100
|
else
|
105
101
|
false
|
106
102
|
end
|
@@ -125,7 +121,7 @@ module OoxmlParser
|
|
125
121
|
red = color_to_check.red
|
126
122
|
green = color_to_check.green
|
127
123
|
blue = color_to_check.blue
|
128
|
-
(self.red - red).abs < delta && (self.green - green).abs < delta && (self.blue - blue).abs < delta
|
124
|
+
(self.red - red).abs < delta && (self.green - green).abs < delta && (self.blue - blue).abs < delta
|
129
125
|
end
|
130
126
|
|
131
127
|
# Apply tint to color
|
@@ -268,7 +264,7 @@ module OoxmlParser
|
|
268
264
|
return Color.new(VALUE_FOR_NONE_COLOR, VALUE_FOR_NONE_COLOR, VALUE_FOR_NONE_COLOR) if str == 'none' || str == '' || str == 'transparent' || str.nil?
|
269
265
|
|
270
266
|
split = if str.include?('RGB (') || str.include?('rgb(')
|
271
|
-
str.gsub(/[(RGBrgb
|
267
|
+
str.gsub(/[(RGBrgb) ]/, '').split(',')
|
272
268
|
elsif str.include?('RGB ') || str.include?('rgb')
|
273
269
|
str.gsub(/RGB |rgb/, '').split(', ')
|
274
270
|
else
|
@@ -34,5 +34,12 @@ module OoxmlParser
|
|
34
34
|
end
|
35
35
|
self
|
36
36
|
end
|
37
|
+
|
38
|
+
# Get content definition by type
|
39
|
+
# @param [String] type of definition
|
40
|
+
# @return [Object] resulting objects
|
41
|
+
def by_type(type)
|
42
|
+
@content_types_list.select { |item| item.content_type == type }
|
43
|
+
end
|
37
44
|
end
|
38
45
|
end
|
@@ -23,8 +23,8 @@ module OoxmlParser
|
|
23
23
|
end
|
24
24
|
string = string.split('!').last
|
25
25
|
if coordinates?(string)
|
26
|
-
coordinates.row = string.scan(/[0-9]/).join
|
27
|
-
coordinates.column = string.scan(/[A-Z]/).join
|
26
|
+
coordinates.row = string.scan(/[0-9]/).join.to_i
|
27
|
+
coordinates.column = string.scan(/[A-Z]/).join
|
28
28
|
end
|
29
29
|
coordinates
|
30
30
|
end
|
@@ -76,7 +76,7 @@ module OoxmlParser
|
|
76
76
|
@action = :last_slide
|
77
77
|
when 'ppaction://hlinksldjump'
|
78
78
|
@action = :slide
|
79
|
-
@url = OOXMLDocumentObject.get_link_from_rels(@id).scan(/\d+/).join
|
79
|
+
@url = OOXMLDocumentObject.get_link_from_rels(@id).scan(/\d+/).join.to_i
|
80
80
|
else
|
81
81
|
if @id && !@id.empty?
|
82
82
|
@action = :external_link
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require_relative 'paragrpah_properties/numbering_properties'
|
4
4
|
require_relative 'paragrpah_properties/paragraph_borders'
|
5
5
|
require_relative 'paragrpah_properties/paragraph_spacing'
|
6
|
+
require_relative 'paragrpah_properties/paragraph_stlye_ref'
|
6
7
|
require_relative 'paragrpah_properties/spacing'
|
7
8
|
require_relative 'paragrpah_properties/tabs'
|
8
9
|
module OoxmlParser
|
@@ -17,6 +18,8 @@ module OoxmlParser
|
|
17
18
|
attr_accessor :run_properties
|
18
19
|
# @return [Borders] borders of paragraph
|
19
20
|
attr_accessor :paragraph_borders
|
21
|
+
# @return [ParagraphStyleRef] Referenced Paragraph Style
|
22
|
+
attr_accessor :paragraph_style_ref
|
20
23
|
# @return [True, False] Specifies that the paragraph
|
21
24
|
# (or at least part of it) should be rendered on
|
22
25
|
# the same page as the next paragraph when possible
|
@@ -30,6 +33,8 @@ module OoxmlParser
|
|
30
33
|
attr_accessor :contextual_spacing
|
31
34
|
# @return [Symbol] The alignment or justification to be applied to a paragraph
|
32
35
|
attr_accessor :justification
|
36
|
+
# @return [Shade] Shade property
|
37
|
+
attr_accessor :shade
|
33
38
|
|
34
39
|
def initialize(numbering = NumberingProperties.new, parent: nil)
|
35
40
|
@numbering = numbering
|
@@ -74,9 +79,7 @@ module OoxmlParser
|
|
74
79
|
@numbering.start_at = node_child.attribute('startAt').value if node_child.attribute('startAt')
|
75
80
|
when 'framePr'
|
76
81
|
@frame_properties = FrameProperties.new(parent: self).parse(node_child)
|
77
|
-
when 'tabs'
|
78
|
-
@tabs = Tabs.new(parent: self).parse(node_child)
|
79
|
-
when 'tabLst'
|
82
|
+
when 'tabs', 'tabLst'
|
80
83
|
@tabs = Tabs.new(parent: self).parse(node_child)
|
81
84
|
when 'ind'
|
82
85
|
@indent = Indents.new(parent: self).parse(node_child)
|
@@ -84,10 +87,14 @@ module OoxmlParser
|
|
84
87
|
@run_properties = RunProperties.new(parent: self).parse(node_child)
|
85
88
|
when 'pBdr'
|
86
89
|
@paragraph_borders = ParagraphBorders.new(parent: self).parse(node_child)
|
90
|
+
when 'pStyle'
|
91
|
+
@paragraph_style_ref = ParagraphStyleRef.new(parent: self).parse(node_child)
|
87
92
|
when 'keepNext'
|
88
93
|
@keep_next = true
|
89
94
|
when 'sectPr'
|
90
95
|
@section_properties = PageProperties.new(parent: self).parse(node_child, @parent, DocxParagraphRun.new)
|
96
|
+
when 'shd'
|
97
|
+
@shade = Shade.new(parent: self).parse(node_child)
|
91
98
|
when 'spacing'
|
92
99
|
@spacing = ParagraphSpacing.new(parent: self).parse(node_child)
|
93
100
|
when 'jc'
|
data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb
CHANGED
@@ -43,5 +43,18 @@ module OoxmlParser
|
|
43
43
|
end
|
44
44
|
self
|
45
45
|
end
|
46
|
+
|
47
|
+
# Helper method to get background color
|
48
|
+
# @return [OoxmlParser::Color]
|
49
|
+
def to_background_color
|
50
|
+
return nil unless fill
|
51
|
+
|
52
|
+
background_color = fill
|
53
|
+
background_color.set_style(value) if value
|
54
|
+
background_color
|
55
|
+
end
|
56
|
+
|
57
|
+
extend Gem::Deprecate
|
58
|
+
deprecate :to_background_color, 'use shade direct methods', 2077, 1
|
46
59
|
end
|
47
60
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `pStyle` tags
|
5
|
+
class ParagraphStyleRef < OOXMLDocumentObject
|
6
|
+
# @return [Integer] value of ParagraphStyleRef
|
7
|
+
attr_reader :value
|
8
|
+
|
9
|
+
# Parse ParagraphStyleRef object
|
10
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
11
|
+
# @return [ParagraphStyleRef] result of parsing
|
12
|
+
def parse(node)
|
13
|
+
node.attributes.each do |key, value|
|
14
|
+
case key
|
15
|
+
when 'val'
|
16
|
+
@value = value.value.to_s
|
17
|
+
end
|
18
|
+
end
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [ParagraphStyle] which was referenced
|
23
|
+
def referenced_style
|
24
|
+
root_object.document_style_by_id(value)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -33,14 +33,10 @@ module OoxmlParser
|
|
33
33
|
other.line_rule = :multiple if other.line_rule == :auto
|
34
34
|
self.line_rule = line_rule.to_sym if line_rule.instance_of?(String)
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
true
|
41
|
-
else
|
42
|
-
false
|
43
|
-
end
|
36
|
+
@before == other.before &&
|
37
|
+
@after == other.after &&
|
38
|
+
@line == other.line &&
|
39
|
+
@line_rule.to_s == other.line_rule.to_s
|
44
40
|
end
|
45
41
|
|
46
42
|
# @return [String] result of convert of object to string
|
@@ -180,7 +180,7 @@ module OoxmlParser
|
|
180
180
|
case element.name
|
181
181
|
when 'p'
|
182
182
|
child = element.child
|
183
|
-
unless child.nil? && doc_structure.elements.last.
|
183
|
+
unless child.nil? && doc_structure.elements.last.instance_of?(Table)
|
184
184
|
paragraph_style = DocumentStructure.default_paragraph_style.dup.parse(element, number, DocumentStructure.default_run_style, parent: doc_structure)
|
185
185
|
number += 1
|
186
186
|
doc_structure.elements << paragraph_style.dup
|
@@ -18,7 +18,7 @@ module OoxmlParser
|
|
18
18
|
# Class for data of DocxParagraph
|
19
19
|
class DocxParagraph < OOXMLDocumentObject
|
20
20
|
include DocxParagraphHelper
|
21
|
-
attr_accessor :number, :bookmark_start, :bookmark_end, :align, :spacing, :
|
21
|
+
attr_accessor :number, :bookmark_start, :bookmark_end, :align, :spacing, :ind, :numbering,
|
22
22
|
:character_style_array, :page_break, :borders, :keep_lines,
|
23
23
|
:contextual_spacing, :sector_properties, :page_numbering, :section_break, :style, :keep_next,
|
24
24
|
:orphan_control
|
@@ -41,7 +41,7 @@ module OoxmlParser
|
|
41
41
|
@number = 0
|
42
42
|
@bookmark_start = []
|
43
43
|
@bookmark_end = []
|
44
|
-
@align =
|
44
|
+
@align = :left
|
45
45
|
@spacing = Spacing.new
|
46
46
|
@ind = Indents.new
|
47
47
|
@character_style_array = []
|
@@ -129,8 +129,8 @@ module OoxmlParser
|
|
129
129
|
when 'bookmarkEnd'
|
130
130
|
character_styles_array << BookmarkEnd.new(parent: self).parse(node_child)
|
131
131
|
when 'pPr'
|
132
|
-
parse_paragraph_style(node_child, custom_character_style)
|
133
132
|
@paragraph_properties = ParagraphProperties.new(parent: self).parse(node_child)
|
133
|
+
parse_paragraph_style(node_child, custom_character_style)
|
134
134
|
when 'commentRangeStart'
|
135
135
|
character_styles_array << CommentRangeStart.new(parent: self).parse(node_child)
|
136
136
|
when 'commentRangeEnd'
|
@@ -177,7 +177,7 @@ module OoxmlParser
|
|
177
177
|
end
|
178
178
|
end
|
179
179
|
@number = par_number
|
180
|
-
character_styles_array.last.text = character_styles_array.last.text.rstrip if character_styles_array.last.
|
180
|
+
character_styles_array.last.text = character_styles_array.last.text.rstrip if character_styles_array.last.instance_of?(DocxParagraphRun)
|
181
181
|
@character_style_array = character_styles_array
|
182
182
|
@parent = parent
|
183
183
|
self
|
@@ -206,10 +206,6 @@ module OoxmlParser
|
|
206
206
|
@keep_next = true
|
207
207
|
when 'contextualSpacing'
|
208
208
|
@contextual_spacing = true
|
209
|
-
when 'shd'
|
210
|
-
background_color_string = node_child.attribute('fill').value
|
211
|
-
@background_color = Color.new(parent: self).parse_hex_string(background_color_string)
|
212
|
-
@background_color.set_style(node_child.attribute('val').value.to_sym) unless node_child.attribute('val').nil?
|
213
209
|
when 'pStyle'
|
214
210
|
parse_paragraph_style_xml(node_child.attribute('val').value, default_char_style)
|
215
211
|
when 'ind'
|
@@ -9,5 +9,12 @@ module OoxmlParser
|
|
9
9
|
|
10
10
|
root_object.comments_extended.by_id(@paragraph_id)
|
11
11
|
end
|
12
|
+
|
13
|
+
# Temp method to return background color
|
14
|
+
# Need to be compatible with older versions
|
15
|
+
# @return [OoxmlParser::Color]
|
16
|
+
def background_color
|
17
|
+
paragraph_properties.shade.to_background_color
|
18
|
+
end
|
12
19
|
end
|
13
20
|
end
|
data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb
CHANGED
@@ -11,7 +11,7 @@ module OoxmlParser
|
|
11
11
|
# Class for working with DocxParagraphRun
|
12
12
|
class DocxParagraphRun < OOXMLDocumentObject
|
13
13
|
include DocxParagraphRunHelpers
|
14
|
-
attr_accessor :number, :font, :vertical_align, :size, :font_color, :
|
14
|
+
attr_accessor :number, :font, :vertical_align, :size, :font_color, :font_style, :text, :drawings,
|
15
15
|
:link, :highlight, :effect, :caps, :w,
|
16
16
|
:position, :em, :spacing, :break, :touch, :shape, :footnote, :endnote, :fld_char, :style,
|
17
17
|
:comments, :alternate_content, :page_number, :text_outline, :text_fill
|
@@ -22,6 +22,8 @@ module OoxmlParser
|
|
22
22
|
attr_accessor :run_properties
|
23
23
|
# @return [RunObject] object of run
|
24
24
|
attr_accessor :object
|
25
|
+
# @return [Shade] shade properties
|
26
|
+
attr_accessor :shade
|
25
27
|
|
26
28
|
def initialize(parent: nil)
|
27
29
|
@number = 0
|
@@ -53,10 +53,7 @@ module OoxmlParser
|
|
53
53
|
when 'color'
|
54
54
|
parse_color_tag(node_child)
|
55
55
|
when 'shd'
|
56
|
-
|
57
|
-
unless node_child.attribute('fill').value == 'auto' || node_child.attribute('fill').value == '' || node_child.attribute('fill').value == 'null'
|
58
|
-
self.background_color = Color.new(parent: self).parse_hex_string(node_child.attribute('fill').value)
|
59
|
-
end
|
56
|
+
@shade = Shade.new(parent: self).parse(node_child)
|
60
57
|
when 'u', 'uCs'
|
61
58
|
parse_underline(node_child)
|
62
59
|
when 'strike'
|
@@ -68,6 +65,13 @@ module OoxmlParser
|
|
68
65
|
self
|
69
66
|
end
|
70
67
|
|
68
|
+
# Temp method to return background color
|
69
|
+
# Need to be compatible with older versions
|
70
|
+
# @return [OoxmlParser::Color]
|
71
|
+
def background_color
|
72
|
+
shade.to_background_color
|
73
|
+
end
|
74
|
+
|
71
75
|
private
|
72
76
|
|
73
77
|
# Parse `color` tag
|
@@ -20,9 +20,7 @@ module OoxmlParser
|
|
20
20
|
case object
|
21
21
|
when :image
|
22
22
|
elements.find { |e| e.is_a? DocxPicture }.properties.transform
|
23
|
-
when :chart
|
24
|
-
elements.find { |e| e.is_a? GraphicFrame }.transform
|
25
|
-
when :table
|
23
|
+
when :chart, :table
|
26
24
|
elements.find { |e| e.is_a? GraphicFrame }.transform
|
27
25
|
when :shape
|
28
26
|
elements.find { |e| !e.shape_properties.preset.nil? }.shape_properties.transform
|
data/lib/ooxml_parser/version.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative 'workbook/chartsheet'
|
4
4
|
require_relative 'workbook/pivot_cache'
|
5
|
+
require_relative 'workbook/pivot_table_definition'
|
5
6
|
require_relative 'workbook/shared_string_table'
|
6
7
|
require_relative 'workbook/style_sheet'
|
7
8
|
require_relative 'workbook/worksheet'
|
@@ -21,10 +22,13 @@ module OoxmlParser
|
|
21
22
|
attr_accessor :shared_strings_table
|
22
23
|
# @return [Array<PivotCache>] list of pivot caches
|
23
24
|
attr_accessor :pivot_caches
|
25
|
+
# @return [Array<PivotTableDefintion>] list of pivot table defitions
|
26
|
+
attr_accessor :pivot_table_definitions
|
24
27
|
|
25
28
|
def initialize(params = {})
|
26
29
|
@worksheets = []
|
27
30
|
@pivot_caches = []
|
31
|
+
@pivot_table_definitions = []
|
28
32
|
super
|
29
33
|
end
|
30
34
|
|
@@ -43,9 +47,10 @@ module OoxmlParser
|
|
43
47
|
return row.cells[column.to_i - 1]
|
44
48
|
elsif sheet.is_a?(String)
|
45
49
|
@worksheets.each do |worksheet|
|
46
|
-
|
47
|
-
|
48
|
-
|
50
|
+
next unless worksheet.name == sheet
|
51
|
+
next unless worksheet.rows[row.to_i - 1]
|
52
|
+
|
53
|
+
return worksheet.rows[row.to_i - 1].cells[column.to_i - 1]
|
49
54
|
end
|
50
55
|
return nil
|
51
56
|
end
|
@@ -119,6 +124,7 @@ module OoxmlParser
|
|
119
124
|
end
|
120
125
|
end
|
121
126
|
parse_pivot_cache
|
127
|
+
parse_pivot_table
|
122
128
|
OOXMLDocumentObject.xmls_stack.pop
|
123
129
|
self
|
124
130
|
end
|
@@ -135,5 +141,13 @@ module OoxmlParser
|
|
135
141
|
@pivot_caches << PivotCache.new(parent: self).parse(pivot_cache)
|
136
142
|
end
|
137
143
|
end
|
144
|
+
|
145
|
+
# Perform parsing of pivot table
|
146
|
+
def parse_pivot_table
|
147
|
+
files = @content_types.by_type('application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml')
|
148
|
+
files.each do |file|
|
149
|
+
@pivot_table_definitions << PivotTableDefinition.new(parent: self).parse(file.part_name)
|
150
|
+
end
|
151
|
+
end
|
138
152
|
end
|
139
153
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'pivot_cache_definition/cache_source'
|
4
|
+
require_relative 'pivot_cache_definition/cache_fields'
|
5
|
+
|
4
6
|
module OoxmlParser
|
5
7
|
# Class for parsing <pivotCacheDefinition> file
|
6
8
|
class PivotCacheDefinition < OOXMLDocumentObject
|
@@ -8,6 +10,8 @@ module OoxmlParser
|
|
8
10
|
attr_reader :id
|
9
11
|
# @return [CacheSource] source of pivot cache
|
10
12
|
attr_reader :cache_source
|
13
|
+
# @return [CacheFields] fields of pivot cache
|
14
|
+
attr_reader :cache_fields
|
11
15
|
|
12
16
|
# Parse PivotCacheDefinition file
|
13
17
|
# @param file [String] path to file
|
@@ -29,6 +33,8 @@ module OoxmlParser
|
|
29
33
|
case node_child.name
|
30
34
|
when 'cacheSource'
|
31
35
|
@cache_source = CacheSource.new(parent: self).parse(node_child)
|
36
|
+
when 'cacheFields'
|
37
|
+
@cache_fields = CacheFields.new(parent: self).parse(node_child)
|
32
38
|
end
|
33
39
|
end
|
34
40
|
self
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'cache_fields/cache_field'
|
4
|
+
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for parsing <cacheFields> tag
|
7
|
+
class CacheFields < OOXMLDocumentObject
|
8
|
+
# @return [Integer] count
|
9
|
+
attr_reader :count
|
10
|
+
# @return [Array<CacheField>] list of CacheField object
|
11
|
+
attr_reader :cache_field
|
12
|
+
|
13
|
+
def initialize(parent: nil)
|
14
|
+
@cache_field = []
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [CacheField] accessor
|
19
|
+
def [](key)
|
20
|
+
@cache_field[key]
|
21
|
+
end
|
22
|
+
|
23
|
+
# Parse `<cacheFields>` tag
|
24
|
+
# @param [Nokogiri::XML:Element] node with cacheFields data
|
25
|
+
# @return [cacheFields]
|
26
|
+
def parse(node)
|
27
|
+
node.attributes.each do |key, value|
|
28
|
+
case key
|
29
|
+
when 'count'
|
30
|
+
@count = value.value.to_i
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
node.xpath('*').each do |node_child|
|
35
|
+
case node_child.name
|
36
|
+
when 'cacheField'
|
37
|
+
@cache_field << CacheField.new(parent: self).parse(node_child)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
self
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'cache_field/shared_items'
|
4
|
+
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for parsing <cacheField> tag
|
7
|
+
class CacheField < OOXMLDocumentObject
|
8
|
+
# @return [String] name of field
|
9
|
+
attr_reader :name
|
10
|
+
# @return [Integer] number format id
|
11
|
+
attr_reader :number_format_id
|
12
|
+
# @return [SharedItems] shared items
|
13
|
+
attr_reader :shared_items
|
14
|
+
|
15
|
+
# Parse `<cacheField>` tag
|
16
|
+
# # @param [Nokogiri::XML:Element] node with WorksheetSource data
|
17
|
+
# @return [CacheField]
|
18
|
+
def parse(node)
|
19
|
+
node.attributes.each do |key, value|
|
20
|
+
case key
|
21
|
+
when 'name'
|
22
|
+
@name = value.value.to_s
|
23
|
+
when 'numFmtId'
|
24
|
+
@number_format_id = value.value.to_i
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
node.xpath('*').each do |node_child|
|
29
|
+
case node_child.name
|
30
|
+
when 'sharedItems'
|
31
|
+
@shared_items = SharedItems.new(parent: self).parse(node_child)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
self
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <sharedItems> tag
|
5
|
+
class SharedItems < OOXMLDocumentObject
|
6
|
+
# @return [True, False] is contains_semi_mixed_types
|
7
|
+
attr_reader :contains_semi_mixed_types
|
8
|
+
# @return [True, False] is contains_string
|
9
|
+
attr_reader :contains_string
|
10
|
+
# @return [True, False] is contains_number
|
11
|
+
attr_reader :contains_number
|
12
|
+
# @return [True, False] is contains_integer
|
13
|
+
attr_reader :contains_integer
|
14
|
+
# @return [Integer] min value
|
15
|
+
attr_reader :min_value
|
16
|
+
# @return [Integer] max value
|
17
|
+
attr_reader :max_value
|
18
|
+
|
19
|
+
# Parse `<sharedItems>` tag
|
20
|
+
# # @param [Nokogiri::XML:Element] node with WorksheetSource data
|
21
|
+
# @return [sharedItems]
|
22
|
+
def parse(node)
|
23
|
+
node.attributes.each do |key, value|
|
24
|
+
case key
|
25
|
+
when 'containsSemiMixedTypes'
|
26
|
+
@contains_semi_mixed_types = attribute_enabled?(value)
|
27
|
+
when 'containsString'
|
28
|
+
@contains_string = attribute_enabled?(value)
|
29
|
+
when 'containsNumber'
|
30
|
+
@contains_number = attribute_enabled?(value)
|
31
|
+
when 'containsInteger'
|
32
|
+
@contains_integer = attribute_enabled?(value)
|
33
|
+
when 'minValue'
|
34
|
+
@min_value = value.value.to_i
|
35
|
+
when 'maxValue'
|
36
|
+
@max_value = value.value.to_i
|
37
|
+
end
|
38
|
+
end
|
39
|
+
self
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'pivot_table_definition/column_row_items'
|
4
|
+
require_relative 'pivot_table_definition/location'
|
5
|
+
require_relative 'pivot_table_definition/pivot_fields'
|
6
|
+
require_relative 'pivot_table_definition/pivot_table_style_info'
|
7
|
+
|
8
|
+
module OoxmlParser
|
9
|
+
# Class for parsing <PivotTableDefinition> tag
|
10
|
+
class PivotTableDefinition < OOXMLDocumentObject
|
11
|
+
# @return [String] name of table
|
12
|
+
attr_reader :name
|
13
|
+
# @return [Integer] id of cache
|
14
|
+
attr_reader :cache_id
|
15
|
+
# @return [True, False] should number formats be applied
|
16
|
+
attr_reader :apply_number_formats
|
17
|
+
# @return [True, False] should border formats be applied
|
18
|
+
attr_reader :apply_border_formats
|
19
|
+
# @return [True, False] should font formats be applied
|
20
|
+
attr_reader :apply_font_formats
|
21
|
+
# @return [True, False] should pattern formats be applied
|
22
|
+
attr_reader :apply_pattern_formats
|
23
|
+
# @return [True, False] should alignment formats be applied
|
24
|
+
attr_reader :apply_alignment_formats
|
25
|
+
# @return [True, False] should width height formats be applied
|
26
|
+
attr_reader :apply_width_height_formats
|
27
|
+
# @return [True, False] should auto formatting be used
|
28
|
+
attr_reader :use_auto_formatting
|
29
|
+
# @return [True, False] should item print titles
|
30
|
+
attr_reader :item_print_titles
|
31
|
+
# @return [String] data caption
|
32
|
+
attr_reader :data_caption
|
33
|
+
# @return [Integer] creation version
|
34
|
+
attr_reader :created_version
|
35
|
+
# @return [Integer] indent
|
36
|
+
attr_reader :indent
|
37
|
+
# @return [True, False] outline
|
38
|
+
attr_reader :outline
|
39
|
+
# @return [True, False] outline data
|
40
|
+
attr_reader :outline_data
|
41
|
+
# @return [True, False] is there multiple fields filters
|
42
|
+
attr_reader :multiple_field_filters
|
43
|
+
# @return [Location] location data
|
44
|
+
attr_reader :location
|
45
|
+
# @return [PivotFields] pivot fields
|
46
|
+
attr_reader :pivot_fields
|
47
|
+
# @return [ColumnRowItems] column items
|
48
|
+
attr_reader :column_items
|
49
|
+
# @return [ColumnRowItems] row items
|
50
|
+
attr_reader :row_items
|
51
|
+
# @return [PivotTableStyleInfo] style info
|
52
|
+
attr_reader :style_info
|
53
|
+
|
54
|
+
# Parse PivotTableDefinition object
|
55
|
+
# @param [String] file path
|
56
|
+
# @return [PivotTableDefinition] result of parsing
|
57
|
+
def parse(file)
|
58
|
+
doc = Nokogiri::XML.parse(File.open("#{OOXMLDocumentObject.path_to_folder}/#{file}"))
|
59
|
+
node = doc.xpath('//xmlns:pivotTableDefinition').first
|
60
|
+
node.attributes.each do |key, value|
|
61
|
+
case key
|
62
|
+
when 'name'
|
63
|
+
@name = value.value.to_s
|
64
|
+
when 'cacheId'
|
65
|
+
@cache_id = value.value.to_i
|
66
|
+
when 'applyNumberFormats'
|
67
|
+
@apply_number_formats = attribute_enabled?(value)
|
68
|
+
when 'applyBorderFormats'
|
69
|
+
@apply_border_formats = attribute_enabled?(value)
|
70
|
+
when 'applyFontFormats'
|
71
|
+
@apply_font_formats = attribute_enabled?(value)
|
72
|
+
when 'applyPatternFormats'
|
73
|
+
@apply_pattern_formats = attribute_enabled?(value)
|
74
|
+
when 'applyAlignmentFormats'
|
75
|
+
@apply_alignment_formats = attribute_enabled?(value)
|
76
|
+
when 'applyWidthHeightFormats'
|
77
|
+
@apply_width_height_formats = attribute_enabled?(value)
|
78
|
+
when 'useAutoFormatting'
|
79
|
+
@use_auto_formatting = attribute_enabled?(value)
|
80
|
+
when 'itemPrintTitles'
|
81
|
+
@item_print_titles = attribute_enabled?(value)
|
82
|
+
when 'dataCaption'
|
83
|
+
@data_caption = value.value.to_s
|
84
|
+
when 'createdVersion'
|
85
|
+
@created_version = value.value.to_i
|
86
|
+
when 'indent'
|
87
|
+
@indent = value.value.to_i
|
88
|
+
when 'outline'
|
89
|
+
@outline = attribute_enabled?(value)
|
90
|
+
when 'outlineData'
|
91
|
+
@outline_data = attribute_enabled?(value)
|
92
|
+
when 'multipleFieldFilters'
|
93
|
+
@multiple_field_filters = attribute_enabled?(value)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
node.xpath('*').each do |node_child|
|
98
|
+
case node_child.name
|
99
|
+
when 'location'
|
100
|
+
@location = Location.new(parent: self).parse(node_child)
|
101
|
+
when 'pivotFields'
|
102
|
+
@pivot_fields = PivotFields.new(parent: self).parse(node_child)
|
103
|
+
when 'rowItems'
|
104
|
+
@row_items = ColumnRowItems.new(parent: self).parse(node_child)
|
105
|
+
when 'colItems'
|
106
|
+
@column_items = ColumnRowItems.new(parent: self).parse(node_child)
|
107
|
+
when 'pivotTableStyleInfo'
|
108
|
+
@style_info = PivotTableStyleInfo.new(parent: self).parse(node_child)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
self
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'column_row_items/column_row_item'
|
4
|
+
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for parsing <rowItems> and <colItems> tag
|
7
|
+
class ColumnRowItems < OOXMLDocumentObject
|
8
|
+
# @return [Integer] count of items
|
9
|
+
attr_reader :count
|
10
|
+
# @return [Array<RowColumnItem>] list of RowColumnItem object
|
11
|
+
attr_reader :items
|
12
|
+
|
13
|
+
def initialize(parent: nil)
|
14
|
+
@items = []
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [RowColumnItem] accessor
|
19
|
+
def [](key)
|
20
|
+
@items[key]
|
21
|
+
end
|
22
|
+
|
23
|
+
# Parse `<cacheField>` tag
|
24
|
+
# # @param [Nokogiri::XML:Element] node with WorksheetSource data
|
25
|
+
# @return [CacheField]
|
26
|
+
def parse(node)
|
27
|
+
node.attributes.each do |key, value|
|
28
|
+
case key
|
29
|
+
when 'count'
|
30
|
+
@count = value.value.to_i
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
node.xpath('*').each do |node_child|
|
35
|
+
case node_child.name
|
36
|
+
when 'i'
|
37
|
+
@items << ColumnRowItem.new(parent: self).parse(node_child)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
self
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <i> tag
|
5
|
+
class ColumnRowItem < OOXMLDocumentObject
|
6
|
+
# @return [Symbol] type of item
|
7
|
+
attr_reader :type
|
8
|
+
|
9
|
+
# Parse `<location>` tag
|
10
|
+
# @param [Nokogiri::XML:Element] node with location data
|
11
|
+
# @return [Location]
|
12
|
+
def parse(node)
|
13
|
+
node.attributes.each do |key, value|
|
14
|
+
case key
|
15
|
+
when 't'
|
16
|
+
@type = value.value.to_sym
|
17
|
+
end
|
18
|
+
end
|
19
|
+
self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/location.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <location> tag
|
5
|
+
class Location < OOXMLDocumentObject
|
6
|
+
# @return [String] ref of location
|
7
|
+
attr_reader :ref
|
8
|
+
# @return [True, False] first header row
|
9
|
+
attr_reader :first_header_row
|
10
|
+
# @return [True, False] first data row
|
11
|
+
attr_reader :first_data_row
|
12
|
+
# @return [True, False] first data column
|
13
|
+
attr_reader :first_data_column
|
14
|
+
|
15
|
+
# Parse `<location>` tag
|
16
|
+
# @param [Nokogiri::XML:Element] node with location data
|
17
|
+
# @return [Location]
|
18
|
+
def parse(node)
|
19
|
+
node.attributes.each do |key, value|
|
20
|
+
case key
|
21
|
+
when 'ref'
|
22
|
+
@ref = value.value.to_s
|
23
|
+
when 'firstHeaderRow'
|
24
|
+
@first_header_row = attribute_enabled?(value)
|
25
|
+
when 'firstDataRow'
|
26
|
+
@first_data_row = attribute_enabled?(value)
|
27
|
+
when 'firstDataCol'
|
28
|
+
@first_data_column = attribute_enabled?(value)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
self
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'pivot_fields/pivot_field'
|
4
|
+
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for parsing <pivotFields> tag
|
7
|
+
class PivotFields < OOXMLDocumentObject
|
8
|
+
# @return [Integer] count
|
9
|
+
attr_reader :count
|
10
|
+
# @return [Array<PivotField>] list of PivotField object
|
11
|
+
attr_reader :pivot_field
|
12
|
+
|
13
|
+
def initialize(parent: nil)
|
14
|
+
@pivot_field = []
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [PivotField] accessor
|
19
|
+
def [](key)
|
20
|
+
@pivot_field[key]
|
21
|
+
end
|
22
|
+
|
23
|
+
# Parse `<pivotFields>` tag
|
24
|
+
# @param [Nokogiri::XML:Element] node with pivotFields data
|
25
|
+
# @return [PivotFields]
|
26
|
+
def parse(node)
|
27
|
+
node.attributes.each do |key, value|
|
28
|
+
case key
|
29
|
+
when 'count'
|
30
|
+
@count = value.value.to_i
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
node.xpath('*').each do |node_child|
|
35
|
+
case node_child.name
|
36
|
+
when 'pivotField'
|
37
|
+
@pivot_field << PivotField.new(parent: self).parse(node_child)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
self
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'pivot_field/items'
|
4
|
+
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for parsing <pivotField> tag
|
7
|
+
class PivotField < OOXMLDocumentObject
|
8
|
+
# @return [String] axis value
|
9
|
+
attr_reader :axis
|
10
|
+
# @return [True, False] should show all
|
11
|
+
attr_reader :show_all
|
12
|
+
# @return [Items] contain item
|
13
|
+
attr_reader :items
|
14
|
+
|
15
|
+
# Parse `<pivotField>` tag
|
16
|
+
# # @param [Nokogiri::XML:Element] node with PivotField data
|
17
|
+
# @return [PivotField]
|
18
|
+
def parse(node)
|
19
|
+
node.attributes.each do |key, value|
|
20
|
+
case key
|
21
|
+
when 'axis'
|
22
|
+
@axis = value.value.to_s
|
23
|
+
when 'showAll'
|
24
|
+
@show_all = attribute_enabled?(value)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
node.xpath('*').each do |node_child|
|
29
|
+
case node_child.name
|
30
|
+
when 'items'
|
31
|
+
@items = Items.new(parent: self).parse(node_child)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
self
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'items/item'
|
4
|
+
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for parsing <items> tag
|
7
|
+
class Items < OOXMLDocumentObject
|
8
|
+
# @return [Integer] count
|
9
|
+
attr_reader :count
|
10
|
+
# @return [Array<Item>] list of items
|
11
|
+
attr_reader :items
|
12
|
+
|
13
|
+
def initialize(parent: nil)
|
14
|
+
@items = []
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Item] accessor
|
19
|
+
def [](key)
|
20
|
+
@items[key]
|
21
|
+
end
|
22
|
+
|
23
|
+
# Parse `<items>` tag
|
24
|
+
# @param [Nokogiri::XML:Element] node with items data
|
25
|
+
# @return [Items]
|
26
|
+
def parse(node)
|
27
|
+
node.attributes.each do |key, value|
|
28
|
+
case key
|
29
|
+
when 'count'
|
30
|
+
@count = value.value.to_i
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
node.xpath('*').each do |node_child|
|
35
|
+
case node_child.name
|
36
|
+
when 'item'
|
37
|
+
@items << Item.new(parent: self).parse(node_child)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
self
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <item> tag
|
5
|
+
class Item < OOXMLDocumentObject
|
6
|
+
# @return [Integer] index of item
|
7
|
+
attr_reader :index
|
8
|
+
# @return [Symbol] type of item
|
9
|
+
attr_reader :type
|
10
|
+
|
11
|
+
# Parse `<item>` tag
|
12
|
+
# # @param [Nokogiri::XML:Element] node with Item data
|
13
|
+
# @return [item]
|
14
|
+
def parse(node)
|
15
|
+
node.attributes.each do |key, value|
|
16
|
+
case key
|
17
|
+
when 'x'
|
18
|
+
@index = value.value.to_i
|
19
|
+
when 't'
|
20
|
+
@type = value.value.to_sym
|
21
|
+
end
|
22
|
+
end
|
23
|
+
self
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <pivotTableStyleInfo> tag
|
5
|
+
class PivotTableStyleInfo < OOXMLDocumentObject
|
6
|
+
# @return [String] name of style
|
7
|
+
attr_reader :name
|
8
|
+
# @return [True, False] show row header
|
9
|
+
attr_reader :show_row_header
|
10
|
+
# @return [True, False] show column header
|
11
|
+
attr_reader :show_column_header
|
12
|
+
# @return [True, False] show row stripes
|
13
|
+
attr_reader :show_row_stripes
|
14
|
+
# @return [True, False] show column stripes
|
15
|
+
attr_reader :show_column_stripes
|
16
|
+
# @return [True, False] show last column
|
17
|
+
attr_reader :show_last_column
|
18
|
+
|
19
|
+
# Parse `<pivotTableStyleInfo>` tag
|
20
|
+
# @param [Nokogiri::XML:Element] node with PivotTableStyleInfo data
|
21
|
+
# @return [PivotTableStyleInfo]
|
22
|
+
def parse(node)
|
23
|
+
node.attributes.each do |key, value|
|
24
|
+
case key
|
25
|
+
when 'name'
|
26
|
+
@name = value.value.to_s
|
27
|
+
when 'showRowHeaders'
|
28
|
+
@show_row_header = attribute_enabled?(value)
|
29
|
+
when 'showColHeaders'
|
30
|
+
@show_column_header = attribute_enabled?(value)
|
31
|
+
when 'showRowStripes'
|
32
|
+
@show_row_stripes = attribute_enabled?(value)
|
33
|
+
when 'showColStripes'
|
34
|
+
@show_column_stripes = attribute_enabled?(value)
|
35
|
+
when 'showLastColumn'
|
36
|
+
@show_last_column = attribute_enabled?(value)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
self
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -22,7 +22,7 @@ module OoxmlParser
|
|
22
22
|
node.attributes.each do |key, value|
|
23
23
|
case key
|
24
24
|
when 'color2'
|
25
|
-
@color2 = Color.new(parent: self).parse_hex_string(value.value.split
|
25
|
+
@color2 = Color.new(parent: self).parse_hex_string(value.value.split.first.delete('#'))
|
26
26
|
when 'id'
|
27
27
|
@id = value.value.to_s
|
28
28
|
@file = FileReference.new(parent: self).parse(node)
|
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.12.2
|
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:
|
13
|
+
date: 2021-02-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -18,118 +18,182 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '1
|
21
|
+
version: '1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '1
|
28
|
+
version: '1'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: ruby-filemagic
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '0
|
35
|
+
version: '0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '0
|
42
|
+
version: '0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rubyzip
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '1.1'
|
50
|
-
- - "<"
|
47
|
+
- - "~>"
|
51
48
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
49
|
+
version: '2'
|
53
50
|
type: :runtime
|
54
51
|
prerelease: false
|
55
52
|
version_requirements: !ruby/object:Gem::Requirement
|
56
53
|
requirements:
|
57
|
-
- - "
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '2'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: overcommit
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: parallel_tests
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
58
76
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
60
|
-
|
77
|
+
version: '3'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
61
83
|
- !ruby/object:Gem::Version
|
62
|
-
version: '3
|
84
|
+
version: '3'
|
63
85
|
- !ruby/object:Gem::Dependency
|
64
86
|
name: rake
|
65
87
|
requirement: !ruby/object:Gem::Requirement
|
66
88
|
requirements:
|
67
89
|
- - "~>"
|
68
90
|
- !ruby/object:Gem::Version
|
69
|
-
version: '13
|
91
|
+
version: '13'
|
70
92
|
type: :development
|
71
93
|
prerelease: false
|
72
94
|
version_requirements: !ruby/object:Gem::Requirement
|
73
95
|
requirements:
|
74
96
|
- - "~>"
|
75
97
|
- !ruby/object:Gem::Version
|
76
|
-
version: '13
|
98
|
+
version: '13'
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: rspec
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '3'
|
106
|
+
type: :development
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '3'
|
77
113
|
- !ruby/object:Gem::Dependency
|
78
114
|
name: rubocop
|
79
115
|
requirement: !ruby/object:Gem::Requirement
|
80
116
|
requirements:
|
81
|
-
- -
|
117
|
+
- - "~>"
|
82
118
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
119
|
+
version: '1'
|
84
120
|
type: :development
|
85
121
|
prerelease: false
|
86
122
|
version_requirements: !ruby/object:Gem::Requirement
|
87
123
|
requirements:
|
88
|
-
- -
|
124
|
+
- - "~>"
|
89
125
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
126
|
+
version: '1'
|
91
127
|
- !ruby/object:Gem::Dependency
|
92
128
|
name: rubocop-performance
|
93
129
|
requirement: !ruby/object:Gem::Requirement
|
94
130
|
requirements:
|
95
|
-
- -
|
131
|
+
- - "~>"
|
96
132
|
- !ruby/object:Gem::Version
|
97
|
-
version: 1
|
133
|
+
version: '1'
|
98
134
|
type: :development
|
99
135
|
prerelease: false
|
100
136
|
version_requirements: !ruby/object:Gem::Requirement
|
101
137
|
requirements:
|
102
|
-
- -
|
138
|
+
- - "~>"
|
103
139
|
- !ruby/object:Gem::Version
|
104
|
-
version: 1
|
140
|
+
version: '1'
|
105
141
|
- !ruby/object:Gem::Dependency
|
106
142
|
name: rubocop-rake
|
107
143
|
requirement: !ruby/object:Gem::Requirement
|
108
144
|
requirements:
|
109
|
-
- -
|
145
|
+
- - "~>"
|
110
146
|
- !ruby/object:Gem::Version
|
111
|
-
version: 0
|
147
|
+
version: '0'
|
112
148
|
type: :development
|
113
149
|
prerelease: false
|
114
150
|
version_requirements: !ruby/object:Gem::Requirement
|
115
151
|
requirements:
|
116
|
-
- -
|
152
|
+
- - "~>"
|
117
153
|
- !ruby/object:Gem::Version
|
118
|
-
version: 0
|
154
|
+
version: '0'
|
119
155
|
- !ruby/object:Gem::Dependency
|
120
156
|
name: rubocop-rspec
|
121
157
|
requirement: !ruby/object:Gem::Requirement
|
122
158
|
requirements:
|
123
|
-
- -
|
159
|
+
- - "~>"
|
124
160
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
161
|
+
version: '2'
|
126
162
|
type: :development
|
127
163
|
prerelease: false
|
128
164
|
version_requirements: !ruby/object:Gem::Requirement
|
129
165
|
requirements:
|
130
|
-
- -
|
166
|
+
- - "~>"
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '2'
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: simplecov
|
171
|
+
requirement: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - "~>"
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
type: :development
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - "~>"
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
- !ruby/object:Gem::Dependency
|
184
|
+
name: yard
|
185
|
+
requirement: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: 0.9.20
|
190
|
+
type: :development
|
191
|
+
prerelease: false
|
192
|
+
version_requirements: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
131
195
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
196
|
+
version: 0.9.20
|
133
197
|
description: Parse OOXML files (docx, xlsx, pptx)
|
134
198
|
email:
|
135
199
|
- shockwavenn@gmail.com
|
@@ -257,6 +321,7 @@ files:
|
|
257
321
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
|
258
322
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb
|
259
323
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
|
324
|
+
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_stlye_ref.rb
|
260
325
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb
|
261
326
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing/line_spacing.rb
|
262
327
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb
|
@@ -423,8 +488,20 @@ files:
|
|
423
488
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb
|
424
489
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache.rb
|
425
490
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb
|
491
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields.rb
|
492
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field.rb
|
493
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field/shared_items.rb
|
426
494
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source.rb
|
427
495
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source/worksheet_source.rb
|
496
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition.rb
|
497
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items.rb
|
498
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items/column_row_item.rb
|
499
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/location.rb
|
500
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields.rb
|
501
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field.rb
|
502
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items.rb
|
503
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items/item.rb
|
504
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_table_style_info.rb
|
428
505
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table.rb
|
429
506
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table/string_index.rb
|
430
507
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb
|
@@ -489,14 +566,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
489
566
|
requirements:
|
490
567
|
- - ">="
|
491
568
|
- !ruby/object:Gem::Version
|
492
|
-
version: '2.
|
569
|
+
version: '2.5'
|
493
570
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
494
571
|
requirements:
|
495
572
|
- - ">="
|
496
573
|
- !ruby/object:Gem::Version
|
497
574
|
version: '0'
|
498
575
|
requirements: []
|
499
|
-
rubygems_version: 3.
|
576
|
+
rubygems_version: 3.2.9
|
500
577
|
signing_key:
|
501
578
|
specification_version: 4
|
502
579
|
summary: OoxmlParser Gem
|