ooxml_parser 0.36.1 → 0.37.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/version.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields/data_field.rb +47 -0
- data/lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/page_fields/page_field.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/page_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/row_fields/field.rb +22 -0
- data/lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/row_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition.rb +19 -0
- data/lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/x14_data_field.rb +22 -0
- data/lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension.rb +5 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87456a8bc9e65bfdc392bc011d85d926898a72fd1fd93b9df816ff9c17829e23
|
4
|
+
data.tar.gz: a1c31e373fe50d84c20a94921efa541b6aec385efb9985def44853c394a8f814
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc5b0d1c069bd862ee61ee2043abe88e3862f509d12e3c5cdb1a3aabb6e40742ae4f16410911fd3a34d8babd21aa94c15bd4a072456b482f00e127a7c371a15d
|
7
|
+
data.tar.gz: 81cde9b66505385865c6a9c236e7c3bd49b7bb5265f260e8821675bff6e0df06c5b12fe190ba79d09f7c23c6158162d69963ba022a9746c7c67ed4880f991114
|
data/lib/ooxml_parser/version.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <dataField> tag
|
5
|
+
class DataField < OOXMLDocumentObject
|
6
|
+
# @return [Integer] index of the base field for the ShowDataAs calculation
|
7
|
+
attr_accessor :base_field
|
8
|
+
# @return [Integer] index of the base item for the ShowDataAs calculation
|
9
|
+
attr_accessor :base_item
|
10
|
+
# @return [Integer] index of the field in the pivotCacheRecords
|
11
|
+
attr_accessor :field
|
12
|
+
# @return [String] name of the data field
|
13
|
+
attr_reader :name
|
14
|
+
# @return [Integer] index of the number format applied to data field
|
15
|
+
attr_accessor :number_format_id
|
16
|
+
# @return [ExtensionList] list of extensions
|
17
|
+
attr_accessor :extension_list
|
18
|
+
|
19
|
+
# Parse `<dataField>` tag
|
20
|
+
# # @param [Nokogiri::XML:Element] node with DataField data
|
21
|
+
# @return [DataField]
|
22
|
+
def parse(node)
|
23
|
+
node.attributes.each do |key, value|
|
24
|
+
case key
|
25
|
+
when 'baseField'
|
26
|
+
@base_field = value.value.to_i
|
27
|
+
when 'baseItem'
|
28
|
+
@base_item = value.value.to_i
|
29
|
+
when 'fld'
|
30
|
+
@field = value.value.to_i
|
31
|
+
when 'name'
|
32
|
+
@name = value.value.to_s
|
33
|
+
when 'numFmtId'
|
34
|
+
@number_format_id = value.value.to_i
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
node.xpath('*').each do |node_child|
|
39
|
+
case node_child.name
|
40
|
+
when 'extLst'
|
41
|
+
@extension_list = ExtensionList.new(parent: self).parse(node_child)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
self
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'data_fields/data_field'
|
4
|
+
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for parsing <dataFields> tag
|
7
|
+
class DataFields < OOXMLDocumentObject
|
8
|
+
# @return [Integer] count
|
9
|
+
attr_reader :count
|
10
|
+
# @return [Array<DataField>] list of DataField object
|
11
|
+
attr_reader :data_field
|
12
|
+
|
13
|
+
def initialize(parent: nil)
|
14
|
+
@data_field = []
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [DataField] accessor
|
19
|
+
def [](key)
|
20
|
+
@data_field[key]
|
21
|
+
end
|
22
|
+
|
23
|
+
# Parse `<dataFields>` tag
|
24
|
+
# @param [Nokogiri::XML:Element] node with dataFields data
|
25
|
+
# @return [DataFields]
|
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 'dataField'
|
37
|
+
@data_field << DataField.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 <pageField> tag
|
5
|
+
class PageField < OOXMLDocumentObject
|
6
|
+
# @return [Integer] index of the field
|
7
|
+
attr_accessor :field
|
8
|
+
# @return [Integer] index of the OLAP hierarchy
|
9
|
+
attr_reader :hierarchy
|
10
|
+
|
11
|
+
# Parse `<pageField>` tag
|
12
|
+
# # @param [Nokogiri::XML:Element] node with PageField data
|
13
|
+
# @return [PageField]
|
14
|
+
def parse(node)
|
15
|
+
node.attributes.each do |key, value|
|
16
|
+
case key
|
17
|
+
when 'fld'
|
18
|
+
@field = value.value.to_i
|
19
|
+
when 'hier'
|
20
|
+
@hierarchy = value.value.to_i
|
21
|
+
end
|
22
|
+
end
|
23
|
+
self
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'page_fields/page_field'
|
4
|
+
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for parsing <pageFields> tag
|
7
|
+
class PageFields < OOXMLDocumentObject
|
8
|
+
# @return [Integer] count
|
9
|
+
attr_reader :count
|
10
|
+
# @return [Array<PageField>] list of PageField object
|
11
|
+
attr_reader :page_field
|
12
|
+
|
13
|
+
def initialize(parent: nil)
|
14
|
+
@page_field = []
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [PageField] accessor
|
19
|
+
def [](key)
|
20
|
+
@page_field[key]
|
21
|
+
end
|
22
|
+
|
23
|
+
# Parse `<pageFields>` tag
|
24
|
+
# @param [Nokogiri::XML:Element] node with pageFields data
|
25
|
+
# @return [PageFields]
|
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 'pageField'
|
37
|
+
@page_field << PageField.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 <field> tag
|
5
|
+
class Field < OOXMLDocumentObject
|
6
|
+
# @return [Integer] the index to a pivotField item value
|
7
|
+
attr_accessor :field_index
|
8
|
+
|
9
|
+
# Parse `<field>` tag
|
10
|
+
# # @param [Nokogiri::XML:Element] node with Field data
|
11
|
+
# @return [Field]
|
12
|
+
def parse(node)
|
13
|
+
node.attributes.each do |key, value|
|
14
|
+
case key
|
15
|
+
when 'x'
|
16
|
+
@field_index = value.value.to_i
|
17
|
+
end
|
18
|
+
end
|
19
|
+
self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'row_fields/field'
|
4
|
+
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for parsing <rowFields> tag
|
7
|
+
class RowFields < OOXMLDocumentObject
|
8
|
+
# @return [Integer] count
|
9
|
+
attr_reader :count
|
10
|
+
# @return [Array<Field>] list of Field object
|
11
|
+
attr_reader :fields
|
12
|
+
|
13
|
+
def initialize(parent: nil)
|
14
|
+
@fields = []
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Field] accessor
|
19
|
+
def [](key)
|
20
|
+
@fields[key]
|
21
|
+
end
|
22
|
+
|
23
|
+
# Parse `<rowFields>` tag
|
24
|
+
# @param [Nokogiri::XML:Element] node with rowFields data
|
25
|
+
# @return [RowFields]
|
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 'field'
|
37
|
+
@fields << Field.new(parent: self).parse(node_child)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
self
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -4,6 +4,9 @@ require_relative 'pivot_table_definition/column_row_items'
|
|
4
4
|
require_relative 'pivot_table_definition/location'
|
5
5
|
require_relative 'pivot_table_definition/pivot_fields'
|
6
6
|
require_relative 'pivot_table_definition/pivot_table_style_info'
|
7
|
+
require_relative 'pivot_table_definition/data_fields'
|
8
|
+
require_relative 'pivot_table_definition/page_fields'
|
9
|
+
require_relative 'pivot_table_definition/row_fields'
|
7
10
|
|
8
11
|
module OoxmlParser
|
9
12
|
# Class for parsing <PivotTableDefinition> tag
|
@@ -50,6 +53,14 @@ module OoxmlParser
|
|
50
53
|
attr_reader :row_items
|
51
54
|
# @return [PivotTableStyleInfo] style info
|
52
55
|
attr_reader :style_info
|
56
|
+
# @return [DataFields] data fields
|
57
|
+
attr_reader :data_fields
|
58
|
+
# @return [PageFields] page fields
|
59
|
+
attr_reader :page_fields
|
60
|
+
# @return [RowFields] row fields
|
61
|
+
attr_reader :row_fields
|
62
|
+
# @return [RowFields] column fields
|
63
|
+
attr_reader :column_fields
|
53
64
|
|
54
65
|
# Parse PivotTableDefinition object
|
55
66
|
# @param [String] file path
|
@@ -106,6 +117,14 @@ module OoxmlParser
|
|
106
117
|
@column_items = ColumnRowItems.new(parent: self).parse(node_child)
|
107
118
|
when 'pivotTableStyleInfo'
|
108
119
|
@style_info = PivotTableStyleInfo.new(parent: self).parse(node_child)
|
120
|
+
when 'dataFields'
|
121
|
+
@data_fields = DataFields.new(parent: self).parse(node_child)
|
122
|
+
when 'pageFields'
|
123
|
+
@page_fields = PageFields.new(parent: self).parse(node_child)
|
124
|
+
when 'rowFields'
|
125
|
+
@row_fields = RowFields.new(parent: self).parse(node_child)
|
126
|
+
when 'colFields'
|
127
|
+
@column_fields = RowFields.new(parent: self).parse(node_child)
|
109
128
|
end
|
110
129
|
end
|
111
130
|
self
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for `x14:dataField` data
|
5
|
+
class X14DataField < OOXMLDocumentObject
|
6
|
+
# @return [Symbol] pivot show as type
|
7
|
+
attr_reader :pivot_show_as
|
8
|
+
|
9
|
+
# Parse X14DataField data
|
10
|
+
# @param [Nokogiri::XML:Element] node with X14DataField data
|
11
|
+
# @return [X14Table] value of X14DataField data
|
12
|
+
def parse(node)
|
13
|
+
node.attributes.each do |key, value|
|
14
|
+
case key
|
15
|
+
when 'pivotShowAs'
|
16
|
+
@pivot_show_as = value.value.to_sym
|
17
|
+
end
|
18
|
+
end
|
19
|
+
self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -4,6 +4,7 @@ require_relative 'extension/data_validations'
|
|
4
4
|
require_relative 'extension/sparkline_groups'
|
5
5
|
require_relative 'extension/x14_table'
|
6
6
|
require_relative 'extension/conditional_formattings'
|
7
|
+
require_relative 'extension/x14_data_field'
|
7
8
|
module OoxmlParser
|
8
9
|
# Class for `ext` data
|
9
10
|
class Extension < OOXMLDocumentObject
|
@@ -15,6 +16,8 @@ module OoxmlParser
|
|
15
16
|
attr_accessor :table
|
16
17
|
# @return [SparklineGroups] list of groups
|
17
18
|
attr_reader :sparkline_groups
|
19
|
+
# @return [X14DataField] pivot data field in x14 namespace
|
20
|
+
attr_accessor :data_field
|
18
21
|
|
19
22
|
# Parse Extension data
|
20
23
|
# @param [Nokogiri::XML:Element] node with Extension data
|
@@ -30,6 +33,8 @@ module OoxmlParser
|
|
30
33
|
@table = X14Table.new(parent: self).parse(column_node)
|
31
34
|
when 'sparklineGroups'
|
32
35
|
@sparkline_groups = SparklineGroups.new(parent: self).parse(column_node)
|
36
|
+
when 'dataField'
|
37
|
+
@data_field = X14DataField.new(parent: self).parse(column_node)
|
33
38
|
end
|
34
39
|
end
|
35
40
|
self
|
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.37.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: 2023-
|
13
|
+
date: 2023-06-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -384,12 +384,18 @@ files:
|
|
384
384
|
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition.rb
|
385
385
|
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/column_row_items.rb
|
386
386
|
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/column_row_items/column_row_item.rb
|
387
|
+
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields.rb
|
388
|
+
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields/data_field.rb
|
387
389
|
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/location.rb
|
390
|
+
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/page_fields.rb
|
391
|
+
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/page_fields/page_field.rb
|
388
392
|
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/pivot_fields.rb
|
389
393
|
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/pivot_fields/pivot_field.rb
|
390
394
|
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/pivot_fields/pivot_field/items.rb
|
391
395
|
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/pivot_fields/pivot_field/items/item.rb
|
392
396
|
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/pivot_table_style_info.rb
|
397
|
+
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/row_fields.rb
|
398
|
+
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/row_fields/field.rb
|
393
399
|
- lib/ooxml_parser/xlsx_parser/workbook/shared_string_table.rb
|
394
400
|
- lib/ooxml_parser/xlsx_parser/workbook/shared_string_table/string_index.rb
|
395
401
|
- lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
|
@@ -447,6 +453,7 @@ files:
|
|
447
453
|
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group.rb
|
448
454
|
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group/sparklines.rb
|
449
455
|
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group/sparklines/sparkline.rb
|
456
|
+
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/x14_data_field.rb
|
450
457
|
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/x14_table.rb
|
451
458
|
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/table_columns.rb
|
452
459
|
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/table_columns/table_column.rb
|
@@ -487,7 +494,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
487
494
|
- !ruby/object:Gem::Version
|
488
495
|
version: '0'
|
489
496
|
requirements: []
|
490
|
-
rubygems_version: 3.4.
|
497
|
+
rubygems_version: 3.4.14
|
491
498
|
signing_key:
|
492
499
|
specification_version: 4
|
493
500
|
summary: OoxmlParser Gem
|