ooxml_parser 0.5.0 → 0.7.2
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.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +6 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +0 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +4 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +0 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +1 -3
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb +0 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +1 -3
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +1 -3
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +1 -3
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/color.rb +39 -7
- data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +5 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +11 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_default.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_override.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +7 -0
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +24 -2
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +0 -6
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +16 -13
- data/lib/ooxml_parser/common_parser/common_data/table.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +7 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +4 -4
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +4 -5
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +6 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +4 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +27 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +22 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_end.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_start.rb +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +13 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +4 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +0 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +0 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +5 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_parser.rb +3 -0
- data/lib/ooxml_parser/name.rb +1 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +15 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +3 -0
- data/lib/ooxml_parser/version.rb +2 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +21 -2
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +3 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache.rb +41 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source/worksheet_source.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +5 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +3 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +5 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +4 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +4 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +3 -0
- metadata +69 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a6c4527d0b7792aa56cbbebb6bd824ae102ef05ebd34cf5c254d237b4db91649
|
|
4
|
+
data.tar.gz: 2ec7cc8db0789617c92def28654e0beac19cbc5197348cb440097a0e911a6542
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5b906924c2cd8fdfb0c199d3de2070964875bd514bfa4090160e3aec18d712d6f5a91159c9a1961d7a76569ba04aef40baedcf5127f1315fc0e628ae50c73fe
|
|
7
|
+
data.tar.gz: 06eb55cf4eb895dc896721e796f97e12e973af1f27fde9e463fcc74ba8994ae6d8ffe3f7d03e64c0a72283a735e9e044f68fa0e93ee0808e0457cf6a67d40100
|
data/lib/ooxml_parser.rb
CHANGED
|
@@ -41,6 +41,9 @@ module OoxmlParser
|
|
|
41
41
|
@parent = parent
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
+
# Parse properties of Chart
|
|
45
|
+
# @param chart_prop_node [Nokogiri::XML:Element] node to parse
|
|
46
|
+
# @return [void]
|
|
44
47
|
def parse_properties(chart_prop_node)
|
|
45
48
|
chart_prop_node.xpath('*').each do |chart_props_node_child|
|
|
46
49
|
case chart_props_node_child.name
|
|
@@ -71,6 +74,9 @@ module OoxmlParser
|
|
|
71
74
|
extend Gem::Deprecate
|
|
72
75
|
deprecate :data, 'series points interface', 2020, 1
|
|
73
76
|
|
|
77
|
+
# Parse Chart
|
|
78
|
+
# @param parent [OOOXMLDocumentObject] parent of chart
|
|
79
|
+
# @return [Chart] result of parsing
|
|
74
80
|
def self.parse(parent: nil)
|
|
75
81
|
chart = Chart.new(parent: parent)
|
|
76
82
|
chart_xml = chart.parse_xml(OOXMLDocumentObject.current_xml)
|
|
@@ -11,7 +11,7 @@ module OoxmlParser
|
|
|
11
11
|
attr_reader :order
|
|
12
12
|
# @return [SeriesText] text of series
|
|
13
13
|
attr_accessor :text
|
|
14
|
-
# @return [
|
|
14
|
+
# @return [SeriesText] categories of chart
|
|
15
15
|
attr_accessor :categories
|
|
16
16
|
# @return [DisplayLabelsProperties]
|
|
17
17
|
attr_accessor :display_labels
|
|
@@ -35,7 +35,7 @@ module OoxmlParser
|
|
|
35
35
|
when 'tx'
|
|
36
36
|
@text = SeriesText.new(parent: self).parse(node_child)
|
|
37
37
|
when 'cat'
|
|
38
|
-
@categories =
|
|
38
|
+
@categories = SeriesText.new(parent: self).parse(node_child)
|
|
39
39
|
when 'dLbls'
|
|
40
40
|
@display_labels = DisplayLabelsProperties.new(parent: self).parse(node_child)
|
|
41
41
|
when 'val'
|
|
@@ -5,6 +5,9 @@ module OoxmlParser
|
|
|
5
5
|
class DocxDrawingDistanceFromText < OOXMLDocumentObject
|
|
6
6
|
attr_accessor :top, :bottom, :left, :right
|
|
7
7
|
|
|
8
|
+
# Parse DocxDrawingDistanceFromText object
|
|
9
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
|
10
|
+
# @return [DocxDrawingDistanceFromText] result of parsing
|
|
8
11
|
def parse(node)
|
|
9
12
|
node.attributes.each do |key, value|
|
|
10
13
|
case key
|
|
@@ -28,6 +28,9 @@ module OoxmlParser
|
|
|
28
28
|
self
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
# Compare this object to other
|
|
32
|
+
# @param other [Object] any other object
|
|
33
|
+
# @return [True, False] result of comparision
|
|
31
34
|
def ==(other)
|
|
32
35
|
(to_base_unit.value - other.to_base_unit.value).abs < 10**(OoxmlParser.configuration.accuracy + 2)
|
|
33
36
|
end
|
|
@@ -40,7 +43,7 @@ module OoxmlParser
|
|
|
40
43
|
# @return [String] string representation of size
|
|
41
44
|
def to_s(unit = :centimeter)
|
|
42
45
|
converted = to_unit(unit)
|
|
43
|
-
"#{converted.value} #{converted.unit}"
|
|
46
|
+
"#{converted.value.to_f} #{converted.unit}"
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
# Convert all values to one same base unit
|
|
@@ -10,6 +10,9 @@ module OoxmlParser
|
|
|
10
10
|
# @return [String] content of file
|
|
11
11
|
attr_accessor :content
|
|
12
12
|
|
|
13
|
+
# Parse FileReference object
|
|
14
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
|
15
|
+
# @return [FileReference] result of parsing
|
|
13
16
|
def parse(node)
|
|
14
17
|
node.attributes.each do |key, value|
|
|
15
18
|
case key
|
|
@@ -26,6 +29,7 @@ module OoxmlParser
|
|
|
26
29
|
return self
|
|
27
30
|
end
|
|
28
31
|
return self if @path == 'NULL'
|
|
32
|
+
return self if @path.match?(URI::DEFAULT_PARSER.make_regexp)
|
|
29
33
|
|
|
30
34
|
full_path_to_file = OOXMLDocumentObject.path_to_folder + OOXMLDocumentObject.root_subfolder + @path.gsub('..', '')
|
|
31
35
|
if File.exist?(full_path_to_file)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative 'docx_shape/ooxml_text_box'
|
|
4
4
|
require_relative 'docx_shape/non_visual_shape_properties'
|
|
5
|
+
require_relative 'docx_shape/shape_style'
|
|
5
6
|
require_relative 'docx_shape/text_body'
|
|
6
7
|
require_relative 'shape_properties/docx_shape_properties'
|
|
7
8
|
require_relative 'shape_body_properties/ooxml_shape_body_properties'
|
|
@@ -32,6 +33,8 @@ module OoxmlParser
|
|
|
32
33
|
@non_visual_properties = NonVisualShapeProperties.new(parent: self).parse(node_child)
|
|
33
34
|
when 'spPr'
|
|
34
35
|
@properties = DocxShapeProperties.new(parent: self).parse(node_child)
|
|
36
|
+
when 'style'
|
|
37
|
+
@style = ShapeStyle.new(parent: self).parse(node_child)
|
|
35
38
|
when 'txbx'
|
|
36
39
|
@text_body = OOXMLTextBox.new(parent: self).parse(node_child)
|
|
37
40
|
when 'txBody'
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module OoxmlParser
|
|
4
4
|
# Class for parsing `txbx` tags
|
|
5
5
|
class OOXMLTextBox < OOXMLDocumentObject
|
|
6
|
-
attr_accessor :
|
|
6
|
+
attr_accessor :elements
|
|
7
7
|
|
|
8
8
|
def initialize(parent: nil)
|
|
9
9
|
@elements = []
|
|
@@ -21,8 +21,6 @@ module OoxmlParser
|
|
|
21
21
|
@elements << DocxParagraph.new(parent: self).parse(node_child, index)
|
|
22
22
|
when 'tbl'
|
|
23
23
|
@elements << Table.new(parent: self).parse(node_child, index)
|
|
24
|
-
when 'bodyPr'
|
|
25
|
-
@properties = OOXMLShapeBodyProperties.new(parent: self).parse(node_child)
|
|
26
24
|
end
|
|
27
25
|
end
|
|
28
26
|
self
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'shape_style/effect_reference'
|
|
4
|
+
require_relative 'shape_style/fill_reference'
|
|
5
|
+
require_relative 'shape_style/font_reference'
|
|
6
|
+
require_relative 'shape_style/line_reference'
|
|
7
|
+
module OoxmlParser
|
|
8
|
+
# Class for parsing `wps:style` tags
|
|
9
|
+
class ShapeStyle < OOXMLDocumentObject
|
|
10
|
+
# @return [FillReference] effect reference
|
|
11
|
+
attr_reader :effect_reference
|
|
12
|
+
# @return [FillReference] fill reference
|
|
13
|
+
attr_reader :fill_reference
|
|
14
|
+
# @return [FontReference] font reference
|
|
15
|
+
attr_reader :font_reference
|
|
16
|
+
# @return [LineReference] line reference
|
|
17
|
+
attr_reader :line_reference
|
|
18
|
+
|
|
19
|
+
def initialize(parent: nil)
|
|
20
|
+
@parent = parent
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Parse ShapeStyle object
|
|
24
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
|
25
|
+
# @return [ShapeStyle] result of parsing
|
|
26
|
+
def parse(node)
|
|
27
|
+
node.xpath('*').each do |node_child|
|
|
28
|
+
case node_child.name
|
|
29
|
+
when 'effectRef'
|
|
30
|
+
@effect_reference = EffectReference.new(parent: self).parse(node_child)
|
|
31
|
+
when 'fillRef'
|
|
32
|
+
@fill_reference = FillReference.new(parent: self).parse(node_child)
|
|
33
|
+
when 'fontRef'
|
|
34
|
+
@font_reference = FontReference.new(parent: self).parse(node_child)
|
|
35
|
+
when 'lnRef'
|
|
36
|
+
@line_reference = LineReference.new(parent: self).parse(node_child)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
self
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OoxmlParser
|
|
4
|
+
# Class for parsing `a:effectRef` tags
|
|
5
|
+
class EffectReference < OOXMLDocumentObject
|
|
6
|
+
# @return [Integer] Style Matrix Index
|
|
7
|
+
attr_reader :index
|
|
8
|
+
# @return [Color] scheme color of EffectReference
|
|
9
|
+
attr_reader :scheme_color
|
|
10
|
+
|
|
11
|
+
def initialize(parent: nil)
|
|
12
|
+
@parent = parent
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Parse EffectReference object
|
|
16
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
|
17
|
+
# @return [EffectReference] result of parsing
|
|
18
|
+
def parse(node)
|
|
19
|
+
node.attributes.each do |key, value|
|
|
20
|
+
case key
|
|
21
|
+
when 'idx'
|
|
22
|
+
@index = value.value.to_f
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
node.xpath('*').each do |node_child|
|
|
27
|
+
case node_child.name
|
|
28
|
+
when 'schemeClr'
|
|
29
|
+
@scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
self
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OoxmlParser
|
|
4
|
+
# Class for parsing `a:fillRef` tags
|
|
5
|
+
class FillReference < OOXMLDocumentObject
|
|
6
|
+
# @return [Integer] Style Matrix Index
|
|
7
|
+
attr_reader :index
|
|
8
|
+
# @return [Color] scheme color of FillReference
|
|
9
|
+
attr_reader :scheme_color
|
|
10
|
+
|
|
11
|
+
def initialize(parent: nil)
|
|
12
|
+
@parent = parent
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Parse FillReference object
|
|
16
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
|
17
|
+
# @return [FillReference] result of parsing
|
|
18
|
+
def parse(node)
|
|
19
|
+
node.attributes.each do |key, value|
|
|
20
|
+
case key
|
|
21
|
+
when 'idx'
|
|
22
|
+
@index = value.value.to_f
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
node.xpath('*').each do |node_child|
|
|
27
|
+
case node_child.name
|
|
28
|
+
when 'schemeClr'
|
|
29
|
+
@scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
self
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OoxmlParser
|
|
4
|
+
# Class for parsing `a:fontRef` tags
|
|
5
|
+
class FontReference < OOXMLDocumentObject
|
|
6
|
+
# @return [String] Font Collection Index
|
|
7
|
+
attr_reader :index
|
|
8
|
+
# @return [Color] scheme color of FontReference
|
|
9
|
+
attr_reader :scheme_color
|
|
10
|
+
|
|
11
|
+
def initialize(parent: nil)
|
|
12
|
+
@parent = parent
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Parse FontReference object
|
|
16
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
|
17
|
+
# @return [FontReference] result of parsing
|
|
18
|
+
def parse(node)
|
|
19
|
+
node.attributes.each do |key, value|
|
|
20
|
+
case key
|
|
21
|
+
when 'idx'
|
|
22
|
+
@index = value.value.to_s
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
node.xpath('*').each do |node_child|
|
|
27
|
+
case node_child.name
|
|
28
|
+
when 'schemeClr'
|
|
29
|
+
@scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
self
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OoxmlParser
|
|
4
|
+
# Class for parsing `a:lnRef` tags
|
|
5
|
+
class LineReference < OOXMLDocumentObject
|
|
6
|
+
# @return [Integer] Style Matrix Index
|
|
7
|
+
attr_reader :index
|
|
8
|
+
# @return [Color] scheme color of LineReference
|
|
9
|
+
attr_reader :scheme_color
|
|
10
|
+
|
|
11
|
+
def initialize(parent: nil)
|
|
12
|
+
@parent = parent
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Parse LineReference object
|
|
16
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
|
17
|
+
# @return [LineReference] result of parsing
|
|
18
|
+
def parse(node)
|
|
19
|
+
node.attributes.each do |key, value|
|
|
20
|
+
case key
|
|
21
|
+
when 'idx'
|
|
22
|
+
@index = value.value.to_f
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
node.xpath('*').each do |node_child|
|
|
27
|
+
case node_child.name
|
|
28
|
+
when 'schemeClr'
|
|
29
|
+
@scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
self
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -10,7 +10,7 @@ require_relative 'custom_geometry/ooxml_custom_geometry'
|
|
|
10
10
|
module OoxmlParser
|
|
11
11
|
# DOCX Shape Properties
|
|
12
12
|
class DocxShapeProperties < OOXMLDocumentObject
|
|
13
|
-
attr_accessor :shape_size, :preset_geometry, :fill_color, :
|
|
13
|
+
attr_accessor :shape_size, :preset_geometry, :fill_color, :line, :custom_geometry
|
|
14
14
|
attr_accessor :blip_fill
|
|
15
15
|
|
|
16
16
|
alias transform shape_size
|
|
@@ -33,8 +33,6 @@ module OoxmlParser
|
|
|
33
33
|
@shape_size = DocxShapeSize.new(parent: self).parse(node_child)
|
|
34
34
|
when 'prstGeom'
|
|
35
35
|
@preset_geometry = PresetGeometry.new(parent: self).parse(node_child)
|
|
36
|
-
when 'txbx'
|
|
37
|
-
@text_box = TextBox.parse_list(node_child)
|
|
38
36
|
when 'ln'
|
|
39
37
|
@line = DocxShapeLine.new(parent: self).parse(node_child)
|
|
40
38
|
when 'blipFill'
|
data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb
CHANGED
|
@@ -6,7 +6,7 @@ require_relative 'group/old_docx_group'
|
|
|
6
6
|
module OoxmlParser
|
|
7
7
|
# Fallback DOCX Picture
|
|
8
8
|
class OldDocxPicture < OOXMLDocumentObject
|
|
9
|
-
attr_accessor :data, :type
|
|
9
|
+
attr_accessor :data, :type
|
|
10
10
|
|
|
11
11
|
# Parse OldDocxPicture object
|
|
12
12
|
# @param node [Nokogiri::XML:Element] node to parse
|
|
@@ -20,8 +20,6 @@ module OoxmlParser
|
|
|
20
20
|
when 'group'
|
|
21
21
|
@type = :group
|
|
22
22
|
@data = OldDocxGroup.new(parent: self).parse(node_child)
|
|
23
|
-
when 'style'
|
|
24
|
-
@style_number = node_child.attribute('val').value.to_i
|
|
25
23
|
end
|
|
26
24
|
end
|
|
27
25
|
self
|