ooxml_parser 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/bullet_image.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/{paragrpah_properties → paragraph_properties}/numbering_properties.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/{paragrpah_properties → paragraph_properties}/paragraph_borders.rb +0 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/{paragrpah_properties → paragraph_properties}/paragraph_spacing.rb +0 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/{paragrpah_properties/paragraph_stlye_ref.rb → paragraph_properties/paragraph_style_ref.rb} +0 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/{paragrpah_properties → paragraph_properties}/spacing/line_spacing.rb +0 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/{paragrpah_properties → paragraph_properties}/spacing.rb +0 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/{paragrpah_properties → paragraph_properties}/tabs/tab.rb +0 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/{paragrpah_properties → paragraph_properties}/tabs.rb +0 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +9 -6
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +4 -6
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox/checkbox_state.rb +26 -0
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb +35 -0
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/combobox/list_item.rb +26 -0
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/combobox.rb +28 -0
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/dropdown_list.rb +27 -0
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb +48 -0
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties/form_text_comb.rb +26 -0
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties/form_text_format.rb +30 -0
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb +45 -0
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb +25 -0
- data/lib/ooxml_parser/version.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/workbook/workbook_properties.rb +27 -0
- data/lib/ooxml_parser/xlsx_parser/workbook.rb +12 -0
- metadata +22 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a2c8bb2410020cc3dfcb2126b9888ef47530fbd761e6167bd917fffee6a1351
|
4
|
+
data.tar.gz: 8ae388b40aabe9e72995e1bb5fa747e73253cd4464e414a00db0dcd5a87b0b40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ce96605c0637a4b2865c96088c0c10ddc898e91e7b6d41234bf8da01b598b748416567aff90cfa33b6778b7f16b7bb9397d95e5dde75e551fe524ee6d72dbdb
|
7
|
+
data.tar.gz: eee336b02e4bc827de7771f46ebcf53907957af7505c7da806dad589fe79f5de56b56e89206bc0e2df1d523530a9a7b41cd7a2c22095da97e95bde953e7faaa9
|
@@ -11,6 +11,8 @@ module OoxmlParser
|
|
11
11
|
attr_reader :theme_shade
|
12
12
|
# @return [Integer] theme index
|
13
13
|
attr_reader :theme
|
14
|
+
# @return [Float] theme tint
|
15
|
+
attr_reader :theme_tint
|
14
16
|
# @return [Float] tint
|
15
17
|
attr_reader :tint
|
16
18
|
# @return [Float] Indexed id
|
@@ -58,6 +60,8 @@ module OoxmlParser
|
|
58
60
|
@indexed = value.value.to_i
|
59
61
|
when 'rgb'
|
60
62
|
@rgb = Color.new.parse_hex_string(value.value)
|
63
|
+
when 'themeTint'
|
64
|
+
@theme_tint = value.value.hex.to_f
|
61
65
|
end
|
62
66
|
end
|
63
67
|
self
|
data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/bullet_image.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <buBlip> tag
|
5
|
+
class BulletImage < OOXMLDocumentObject
|
6
|
+
# @return [FileReference] image structure
|
7
|
+
attr_reader :file_reference
|
8
|
+
|
9
|
+
# Parse BulletImage object
|
10
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
11
|
+
# @return [BulletImage] result of parsing
|
12
|
+
def parse(node)
|
13
|
+
node.xpath('*').each do |node_child|
|
14
|
+
case node_child.name
|
15
|
+
when 'blip'
|
16
|
+
@file_reference = FileReference.new(parent: self).parse(node_child)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module OoxmlParser
|
4
4
|
# Class for parsing `numPr` tags
|
5
5
|
class NumberingProperties < OOXMLDocumentObject
|
6
|
-
attr_accessor :size, :font, :symbol, :start_at, :type, :ilvl, :numbering_properties
|
6
|
+
attr_accessor :size, :font, :symbol, :start_at, :type, :image, :ilvl, :numbering_properties
|
7
7
|
|
8
8
|
def initialize(ilvl = 0, parent: nil)
|
9
9
|
@ilvl = ilvl
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
4
|
-
require_relative '
|
5
|
-
require_relative '
|
6
|
-
require_relative '
|
7
|
-
require_relative '
|
8
|
-
require_relative '
|
3
|
+
require_relative 'paragraph_properties/numbering_properties'
|
4
|
+
require_relative 'paragraph_properties/paragraph_borders'
|
5
|
+
require_relative 'paragraph_properties/paragraph_spacing'
|
6
|
+
require_relative 'paragraph_properties/paragraph_style_ref'
|
7
|
+
require_relative 'paragraph_properties/spacing'
|
8
|
+
require_relative 'paragraph_properties/tabs'
|
9
|
+
require_relative 'paragraph_properties/bullet_image'
|
9
10
|
module OoxmlParser
|
10
11
|
# Class for data for ParagraphProperties
|
11
12
|
class ParagraphProperties < OOXMLDocumentObject
|
@@ -74,6 +75,8 @@ module OoxmlParser
|
|
74
75
|
@numbering.font = node_child.attribute('typeface').value
|
75
76
|
when 'buChar'
|
76
77
|
@numbering.symbol = node_child.attribute('char').value
|
78
|
+
when 'buBlip'
|
79
|
+
@numbering.image = BulletImage.new(parent: self).parse(node_child)
|
77
80
|
when 'buAutoNum'
|
78
81
|
@numbering.type = node_child.attribute('type').value.to_sym
|
79
82
|
@numbering.start_at = node_child.attribute('startAt').value if node_child.attribute('startAt')
|
@@ -78,17 +78,15 @@ module OoxmlParser
|
|
78
78
|
# @param node [Nokogiri::XML:Element] node to parse
|
79
79
|
# @return [nil]
|
80
80
|
def parse_color_tag(node)
|
81
|
-
|
81
|
+
color = OoxmlColor.new(parent: self).parse(node)
|
82
|
+
node.attributes.sort.to_h.each do |key, value|
|
82
83
|
case key
|
83
84
|
when 'val'
|
84
85
|
self.font_color = Color.new(parent: self).parse_hex_string(value.value)
|
85
86
|
when 'themeColor'
|
86
|
-
if root_object.theme && root_object.theme.color_scheme[value.value.to_sym]
|
87
|
-
break if value.value == 'text2' || value.value == 'background2' || value.value.include?('accent') # Don't know why. Just works
|
88
|
-
|
89
|
-
self.font_color = root_object.theme.color_scheme[value.value.to_sym].color.dup
|
90
|
-
end
|
87
|
+
self.font_color = root_object.theme.color_scheme[value.value.to_sym].color.dup if root_object.theme && root_object.theme.color_scheme[value.value.to_sym]
|
91
88
|
when 'themeShade'
|
89
|
+
self.font_color = color.value if font_color.none?
|
92
90
|
font_color.calculate_with_shade!(value.value.hex.to_f / 255.0)
|
93
91
|
when 'themeTint'
|
94
92
|
font_color.calculate_with_tint!(1.0 - (value.value.hex.to_f / 255.0))
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `checkedState` tag
|
5
|
+
class CheckBoxState < OOXMLDocumentObject
|
6
|
+
# @return [Integer] number of state symbol
|
7
|
+
attr_reader :value
|
8
|
+
# @return [String] font name
|
9
|
+
attr_reader :font
|
10
|
+
|
11
|
+
# Parse CheckBoxState object
|
12
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
13
|
+
# @return [CheckBoxState] result of parsing
|
14
|
+
def parse(node)
|
15
|
+
node.attributes.each do |key, value|
|
16
|
+
case key
|
17
|
+
when 'val'
|
18
|
+
@value = value.value.to_i
|
19
|
+
when 'font'
|
20
|
+
@font = value.value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
self
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'checkbox/checkbox_state'
|
4
|
+
module OoxmlParser
|
5
|
+
# Class for parsing `checkbox` tag
|
6
|
+
class CheckBox < OOXMLDocumentObject
|
7
|
+
# @return [True, False] specifies if checkbox is checked
|
8
|
+
attr_reader :checked
|
9
|
+
# @return [CheckBoxState] options of checked state
|
10
|
+
attr_reader :checked_state
|
11
|
+
# @return [CheckBoxState] options of unchecked state
|
12
|
+
attr_reader :unchecked_state
|
13
|
+
# @return [ValuedChild] group key
|
14
|
+
attr_reader :group_key
|
15
|
+
|
16
|
+
# Parse CheckBox object
|
17
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
18
|
+
# @return [CheckBox] result of parsing
|
19
|
+
def parse(node)
|
20
|
+
node.xpath('*').each do |node_child|
|
21
|
+
case node_child.name
|
22
|
+
when 'checked'
|
23
|
+
@checked = option_enabled?(node_child, 'hidden')
|
24
|
+
when 'checkedState'
|
25
|
+
@checked_state = CheckBoxState.new(parent: self).parse(node_child)
|
26
|
+
when 'uncheckedState'
|
27
|
+
@unchecked_state = CheckBoxState.new(parent: self).parse(node_child)
|
28
|
+
when 'groupKey'
|
29
|
+
@group_key = ValuedChild.new(:string, parent: self).parse(node_child)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
self
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `listItem` tag
|
5
|
+
class ListItem < OOXMLDocumentObject
|
6
|
+
# @return [String] item text
|
7
|
+
attr_reader :text
|
8
|
+
# @return [String] item value
|
9
|
+
attr_reader :value
|
10
|
+
|
11
|
+
# Parse ListItem object
|
12
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
13
|
+
# @return [ListItem] result of parsing
|
14
|
+
def parse(node)
|
15
|
+
node.attributes.each do |key, value|
|
16
|
+
case key
|
17
|
+
when 'displayText'
|
18
|
+
@text = value.value
|
19
|
+
when 'value'
|
20
|
+
@value = value.value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
self
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/combobox.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'combobox/list_item'
|
4
|
+
module OoxmlParser
|
5
|
+
# Class for parsing `comboBox` tag
|
6
|
+
class ComboBox < OOXMLDocumentObject
|
7
|
+
# @return [Array<ListItem>] combobox items
|
8
|
+
attr_reader :list_items
|
9
|
+
|
10
|
+
def initialize(parent: nil)
|
11
|
+
@list_items = []
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
# Parse ComboBox object
|
16
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
17
|
+
# @return [ComboBox] result of parsing
|
18
|
+
def parse(node)
|
19
|
+
node.xpath('*').each do |node_child|
|
20
|
+
case node_child.name
|
21
|
+
when 'listItem'
|
22
|
+
@list_items << ListItem.new(parent: self).parse(node_child)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `dropDownList` tag
|
5
|
+
class DropdownList < OOXMLDocumentObject
|
6
|
+
# @return [Array<ListItem>] dropdown items
|
7
|
+
attr_reader :list_items
|
8
|
+
|
9
|
+
def initialize(parent: nil)
|
10
|
+
@list_items = []
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
# Parse DropdownList object
|
15
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
16
|
+
# @return [DropdownList] result of parsing
|
17
|
+
def parse(node)
|
18
|
+
node.xpath('*').each do |node_child|
|
19
|
+
case node_child.name
|
20
|
+
when 'listItem'
|
21
|
+
@list_items << ListItem.new(parent: self).parse(node_child)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
self
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `formPr` tag
|
5
|
+
class FormProperties < OOXMLDocumentObject
|
6
|
+
# @return [String] field key
|
7
|
+
attr_reader :key
|
8
|
+
# @return [String] text of tooltip
|
9
|
+
attr_reader :help_text
|
10
|
+
# @return [True, False] specifies if field is required
|
11
|
+
attr_reader :required
|
12
|
+
# @return [Shade] shade of field
|
13
|
+
attr_reader :shade
|
14
|
+
# @return [BordersProperties] border of field
|
15
|
+
attr_reader :border
|
16
|
+
|
17
|
+
def initialize(parent: nil)
|
18
|
+
@required = false
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
# Parse FormProperties object
|
23
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
24
|
+
# @return [FormProperties] result of parsing
|
25
|
+
def parse(node)
|
26
|
+
node.attributes.each do |key, value|
|
27
|
+
case key
|
28
|
+
when 'key'
|
29
|
+
@key = value.value
|
30
|
+
when 'helpText'
|
31
|
+
@help_text = value.value
|
32
|
+
when 'required'
|
33
|
+
@required = option_enabled?(value)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
node.xpath('*').each do |node_child|
|
38
|
+
case node_child.name
|
39
|
+
when 'shd'
|
40
|
+
@shade = Shade.new(parent: self).parse(node_child)
|
41
|
+
when 'border'
|
42
|
+
@border = BordersProperties.new(parent: self).parse(node_child)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
self
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `comb` tag
|
5
|
+
class FormTextComb < OOXMLDocumentObject
|
6
|
+
# @return [OoxmlSize] field width
|
7
|
+
attr_reader :width
|
8
|
+
# @return [Symbol] width rule
|
9
|
+
attr_reader :width_rule
|
10
|
+
|
11
|
+
# Parse FormTextComb object
|
12
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
13
|
+
# @return [FormTextComb] result of parsing
|
14
|
+
def parse(node)
|
15
|
+
node.attributes.each do |key, value|
|
16
|
+
case key
|
17
|
+
when 'width'
|
18
|
+
@width = OoxmlSize.new(value.value.to_f)
|
19
|
+
when 'wRule'
|
20
|
+
@width_rule = value.value.to_sym
|
21
|
+
end
|
22
|
+
end
|
23
|
+
self
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `format` tag
|
5
|
+
class FormTextFormat < OOXMLDocumentObject
|
6
|
+
# @return [Symbol] format type
|
7
|
+
attr_reader :type
|
8
|
+
# @return [String] value for custom formats
|
9
|
+
attr_reader :value
|
10
|
+
# @return [String] allowed symbols
|
11
|
+
attr_reader :symbols
|
12
|
+
|
13
|
+
# Parse FormTextFormat object
|
14
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
15
|
+
# @return [FormTextFormat] result of parsing
|
16
|
+
def parse(node)
|
17
|
+
node.attributes.each do |key, value|
|
18
|
+
case key
|
19
|
+
when 'type'
|
20
|
+
@type = value.value.to_sym
|
21
|
+
when 'val'
|
22
|
+
@value = value.value
|
23
|
+
when 'symbols'
|
24
|
+
@symbols = value.value
|
25
|
+
end
|
26
|
+
end
|
27
|
+
self
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'form_text_properties/form_text_comb'
|
4
|
+
require_relative 'form_text_properties/form_text_format'
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for parsing `textFormPr` tag
|
7
|
+
class FormTextProperties < OOXMLDocumentObject
|
8
|
+
# @return [True, False] specifies if field is multiline
|
9
|
+
attr_reader :multiline
|
10
|
+
# @return [True, False] specifies if size of field should be autofit
|
11
|
+
attr_reader :autofit
|
12
|
+
# @return [FormTextComb] parameters of text justification
|
13
|
+
attr_reader :comb
|
14
|
+
# @return [ValuedChild] characters limit
|
15
|
+
attr_reader :maximum_characters
|
16
|
+
# @return [FormTextFormat] text format
|
17
|
+
attr_reader :format
|
18
|
+
|
19
|
+
# Parse FormTextProperties object
|
20
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
21
|
+
# @return [FormTextProperties] result of parsing
|
22
|
+
def parse(node)
|
23
|
+
node.attributes.each do |key, value|
|
24
|
+
case key
|
25
|
+
when 'multiLine'
|
26
|
+
@multiline = option_enabled?(value)
|
27
|
+
when 'autoFit'
|
28
|
+
@autofit = option_enabled?(value)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
node.xpath('*').each do |node_child|
|
33
|
+
case node_child.name
|
34
|
+
when 'comb'
|
35
|
+
@comb = FormTextComb.new(parent: self).parse(node_child)
|
36
|
+
when 'maxCharacters'
|
37
|
+
@maximum_characters = ValuedChild.new(:integer, parent: self).parse(node_child)
|
38
|
+
when 'format'
|
39
|
+
@format = FormTextFormat.new(parent: self).parse(node_child)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
self
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -1,5 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'sdt_properties/form_properties'
|
4
|
+
require_relative 'sdt_properties/form_text_properties'
|
5
|
+
require_relative 'sdt_properties/combobox'
|
6
|
+
require_relative 'sdt_properties/dropdown_list'
|
7
|
+
require_relative 'sdt_properties/checkbox'
|
3
8
|
module OoxmlParser
|
4
9
|
# Class for parsing `w:sdtPr` tags
|
5
10
|
class SDTProperties < OOXMLDocumentObject
|
@@ -9,6 +14,16 @@ module OoxmlParser
|
|
9
14
|
attr_reader :tag
|
10
15
|
# @return [ValuedChild] Locking Setting
|
11
16
|
attr_reader :lock
|
17
|
+
# @return [ComboBox] combobox
|
18
|
+
attr_reader :combobox
|
19
|
+
# @return [DropdownList] dropdown list
|
20
|
+
attr_reader :dropdown_list
|
21
|
+
# @return [CheckBox] checkbox
|
22
|
+
attr_reader :checkbox
|
23
|
+
# @return [FormProperties] form properties
|
24
|
+
attr_reader :form_properties
|
25
|
+
# @return [FormTextProperties] properties of text in form
|
26
|
+
attr_reader :form_text_properties
|
12
27
|
|
13
28
|
# Parse SDTProperties object
|
14
29
|
# @param node [Nokogiri::XML:Element] node to parse
|
@@ -22,6 +37,16 @@ module OoxmlParser
|
|
22
37
|
@tag = ValuedChild.new(:string, parent: self).parse(node_child)
|
23
38
|
when 'lock'
|
24
39
|
@lock = ValuedChild.new(:symbol, parent: self).parse(node_child)
|
40
|
+
when 'comboBox'
|
41
|
+
@combobox = ComboBox.new(parent: self).parse(node_child)
|
42
|
+
when 'dropDownList'
|
43
|
+
@dropdown_list = DropdownList.new(parent: self).parse(node_child)
|
44
|
+
when 'checkbox'
|
45
|
+
@checkbox = CheckBox.new(parent: self).parse(node_child)
|
46
|
+
when 'formPr'
|
47
|
+
@form_properties = FormProperties.new(parent: self).parse(node_child)
|
48
|
+
when 'textFormPr'
|
49
|
+
@form_text_properties = FormTextProperties.new(parent: self).parse(node_child)
|
25
50
|
end
|
26
51
|
end
|
27
52
|
self
|
data/lib/ooxml_parser/version.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <workbookPr> tag
|
5
|
+
class WorkbookProperties < OOXMLDocumentObject
|
6
|
+
# @return [True, False] Specifies if 1904 date system is used in workbook
|
7
|
+
attr_reader :date1904
|
8
|
+
|
9
|
+
def initialize(parent: nil)
|
10
|
+
@date1904 = false
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
# Parse WorkbookProperties data
|
15
|
+
# @param [Nokogiri::XML:Element] node with WorkbookProperties data
|
16
|
+
# @return [WorkbookProperties] value of WorkbookProperties
|
17
|
+
def parse(node)
|
18
|
+
node.attributes.each do |key, value|
|
19
|
+
case key
|
20
|
+
when 'date1904'
|
21
|
+
@date1904 = attribute_enabled?(value)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
self
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -4,6 +4,7 @@ require_relative 'workbook/chartsheet'
|
|
4
4
|
require_relative 'workbook/pivot_cache'
|
5
5
|
require_relative 'workbook/pivot_table_definition'
|
6
6
|
require_relative 'workbook/defined_name'
|
7
|
+
require_relative 'workbook/workbook_properties'
|
7
8
|
require_relative 'workbook/workbook_protection'
|
8
9
|
require_relative 'workbook/shared_string_table'
|
9
10
|
require_relative 'workbook/style_sheet'
|
@@ -31,6 +32,8 @@ module OoxmlParser
|
|
31
32
|
attr_accessor :pivot_table_definitions
|
32
33
|
# @return [Array<DefinedName>] list of defined names
|
33
34
|
attr_reader :defined_names
|
35
|
+
# @return [WorkbookProperties] workbook properties
|
36
|
+
attr_reader :workbook_properties
|
34
37
|
# @return [WorkbookProtection] protection of workbook structure
|
35
38
|
attr_reader :workbook_protection
|
36
39
|
|
@@ -137,6 +140,7 @@ module OoxmlParser
|
|
137
140
|
parse_pivot_cache
|
138
141
|
parse_pivot_table
|
139
142
|
parse_defined_names
|
143
|
+
parse_workbook_properties
|
140
144
|
parse_workbook_protection
|
141
145
|
root_object.xmls_stack.pop
|
142
146
|
self
|
@@ -170,6 +174,14 @@ module OoxmlParser
|
|
170
174
|
end
|
171
175
|
end
|
172
176
|
|
177
|
+
# Perform parsing of workbook properties
|
178
|
+
def parse_workbook_properties
|
179
|
+
workbook_properties = @doc.search('//xmlns:workbookPr').first
|
180
|
+
return nil unless workbook_properties
|
181
|
+
|
182
|
+
@workbook_properties = WorkbookProperties.new(parent: self).parse(workbook_properties)
|
183
|
+
end
|
184
|
+
|
173
185
|
# Perform parsing of workbook protection
|
174
186
|
def parse_workbook_protection
|
175
187
|
workbook_protection = @doc.search('//xmlns:workbookProtection').first
|
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.33.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: 2022-
|
13
|
+
date: 2022-10-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -312,6 +312,15 @@ files:
|
|
312
312
|
- lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_object_attribute_helper.rb
|
313
313
|
- lib/ooxml_parser/common_parser/common_data/paragraph.rb
|
314
314
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb
|
315
|
+
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/bullet_image.rb
|
316
|
+
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/numbering_properties.rb
|
317
|
+
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb
|
318
|
+
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_spacing.rb
|
319
|
+
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_style_ref.rb
|
320
|
+
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/spacing.rb
|
321
|
+
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/spacing/line_spacing.rb
|
322
|
+
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs.rb
|
323
|
+
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs/tab.rb
|
315
324
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb
|
316
325
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb
|
317
326
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb
|
@@ -321,14 +330,6 @@ files:
|
|
321
330
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb
|
322
331
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb
|
323
332
|
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/text.rb
|
324
|
-
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
|
325
|
-
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb
|
326
|
-
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
|
327
|
-
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_stlye_ref.rb
|
328
|
-
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb
|
329
|
-
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing/line_spacing.rb
|
330
|
-
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb
|
331
|
-
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/tab.rb
|
332
333
|
- lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb
|
333
334
|
- lib/ooxml_parser/common_parser/common_data/relationships.rb
|
334
335
|
- lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb
|
@@ -423,6 +424,15 @@ files:
|
|
423
424
|
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/inserted.rb
|
424
425
|
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_content.rb
|
425
426
|
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb
|
427
|
+
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
|
428
|
+
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox/checkbox_state.rb
|
429
|
+
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/combobox.rb
|
430
|
+
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/combobox/list_item.rb
|
431
|
+
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/dropdown_list.rb
|
432
|
+
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb
|
433
|
+
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb
|
434
|
+
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties/form_text_comb.rb
|
435
|
+
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties/form_text_format.rb
|
426
436
|
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/structured_document_tag.rb
|
427
437
|
- lib/ooxml_parser/docx_parser/document_structure/header_footer.rb
|
428
438
|
- lib/ooxml_parser/docx_parser/document_structure/numbering.rb
|
@@ -532,6 +542,7 @@ files:
|
|
532
542
|
- lib/ooxml_parser/xlsx_parser/workbook/style_sheet/xlsx_borders.rb
|
533
543
|
- lib/ooxml_parser/xlsx_parser/workbook/style_sheet/xlsx_borders/xlsx_border.rb
|
534
544
|
- lib/ooxml_parser/xlsx_parser/workbook/workbook_helpers.rb
|
545
|
+
- lib/ooxml_parser/xlsx_parser/workbook/workbook_properties.rb
|
535
546
|
- lib/ooxml_parser/xlsx_parser/workbook/workbook_protection.rb
|
536
547
|
- lib/ooxml_parser/xlsx_parser/workbook/worksheet.rb
|
537
548
|
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/excel_comments.rb
|
@@ -608,7 +619,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
608
619
|
- !ruby/object:Gem::Version
|
609
620
|
version: '0'
|
610
621
|
requirements: []
|
611
|
-
rubygems_version: 3.3.
|
622
|
+
rubygems_version: 3.3.24
|
612
623
|
signing_key:
|
613
624
|
specification_version: 4
|
614
625
|
summary: OoxmlParser Gem
|