ooxml_parser 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +1 -20
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +51 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +12 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +10 -3
- data/lib/ooxml_parser/common_parser/common_data/color.rb +9 -75
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +4 -3
- data/lib/ooxml_parser/common_parser/common_data/color/color_indexes.list +66 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +8 -2
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +14 -3
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +28 -6
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +3 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +14 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +3 -7
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +2 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +8 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +3 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +3 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +2 -2
- data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +1 -1
- data/lib/ooxml_parser/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bff9ef732546243f5b751041e9fb41602a4e0ca823f93a83f671975e881cf6fd
|
4
|
+
data.tar.gz: 3e5bc500fb572b0fa43297f6d85a0f47e1d35365caed9803441b81785808e83d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93a6648cf7f5ce6a088d3c654c2c50b04afb363507e20ef8f2198ba35265310dfc44205819b32d635b997c589656bb87514fc5ab2007d2b898accf4d8fcb2b4b
|
7
|
+
data.tar.gz: 3e3f6e9c0a70516a176f5614294f8aecb02be45219c9a9c6799d3b3e75e7a2d7b6ff0a3680e6a8f18d8bbd6d8658740cac1157447b94659bd082a07ec9025a5e
|
@@ -30,34 +30,15 @@ module OoxmlParser
|
|
30
30
|
when 'inline'
|
31
31
|
@type = :inline
|
32
32
|
end
|
33
|
-
@properties.distance_from_text = DocxDrawingDistanceFromText.new(parent: self).parse(node_child)
|
34
|
-
@properties.wrap = DocxWrapDrawing.new(parent: self).parse(node_child)
|
35
|
-
node_child.attributes.each do |key, value|
|
36
|
-
case key
|
37
|
-
when 'relativeHeight'
|
38
|
-
@properties.relative_height = value.value.to_i
|
39
|
-
end
|
40
|
-
end
|
41
33
|
node_child.xpath('*').each do |content_node_child|
|
42
34
|
case content_node_child.name
|
43
|
-
when 'simplePos'
|
44
|
-
@properties.simple_position = OOXMLCoordinates.parse(content_node_child)
|
45
|
-
when 'extent'
|
46
|
-
@properties.object_size = OOXMLCoordinates.parse(content_node_child, x_attr: 'cx', y_attr: 'cy', unit: :emu)
|
47
35
|
when 'graphic'
|
48
36
|
@graphic = DocxGraphic.new(parent: self).parse(content_node_child)
|
49
|
-
when 'positionV'
|
50
|
-
@properties.vertical_position = DocxDrawingPosition.new(parent: self).parse(content_node_child)
|
51
|
-
when 'positionH'
|
52
|
-
@properties.horizontal_position = DocxDrawingPosition.new(parent: self).parse(content_node_child)
|
53
|
-
when 'sizeRelH'
|
54
|
-
@properties.size_relative_horizontal = SizeRelativeHorizontal.new(parent: self).parse(content_node_child)
|
55
|
-
when 'sizeRelV'
|
56
|
-
@properties.size_relative_vertical = SizeRelativeVertical.new(parent: self).parse(content_node_child)
|
57
37
|
when 'docPr'
|
58
38
|
@doc_properties = DocProperties.new(parent: self).parse(content_node_child)
|
59
39
|
end
|
60
40
|
end
|
41
|
+
@properties.parse(node_child)
|
61
42
|
end
|
62
43
|
self
|
63
44
|
end
|
@@ -8,9 +8,56 @@ require_relative 'docx_wrap_drawing'
|
|
8
8
|
module OoxmlParser
|
9
9
|
# Docx Drawing Properties
|
10
10
|
class DocxDrawingProperties < OOXMLDocumentObject
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# @return [DocxDrawingDistanceFromText] distance from text
|
12
|
+
attr_reader :distance_from_text
|
13
|
+
# @return [DocxWrapDrawing] wrap of drawing
|
14
|
+
attr_reader :wrap
|
15
|
+
# @return [Integer] relative height of object
|
16
|
+
attr_reader :relative_height
|
17
|
+
# @return [OOXMLCoordinates] simple position of object
|
18
|
+
attr_reader :simple_position
|
19
|
+
# @return [OOXMLCoordinates] size of object
|
20
|
+
attr_reader :object_size
|
21
|
+
# @return [DocxDrawingPosition] vertical position
|
22
|
+
attr_reader :vertical_position
|
23
|
+
# @return [DocxDrawingPosition] horizontal position
|
24
|
+
attr_reader :horizontal_position
|
25
|
+
# @return [SizeRelativeHorizontal] size of drawing relative to horizontal
|
26
|
+
attr_reader :size_relative_horizontal
|
27
|
+
# @return [SizeRelativeVertical] size of drawing relative to vertical
|
28
|
+
attr_reader :size_relative_vertical
|
29
|
+
|
30
|
+
# Parse DocxDrawingProperties
|
31
|
+
# @param [Nokogiri::XML:Node] node with DocxDrawingProperties
|
32
|
+
# @return [DocxDrawingProperties] result of parsing
|
33
|
+
def parse(node)
|
34
|
+
@distance_from_text = DocxDrawingDistanceFromText.new(parent: self).parse(node)
|
35
|
+
@wrap = DocxWrapDrawing.new(parent: self).parse(node)
|
36
|
+
|
37
|
+
node.attributes.each do |key, value|
|
38
|
+
case key
|
39
|
+
when 'relativeHeight'
|
40
|
+
@relative_height = value.value.to_i
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
node.xpath('*').each do |content_node_child|
|
45
|
+
case content_node_child.name
|
46
|
+
when 'simplePos'
|
47
|
+
@simple_position = OOXMLCoordinates.parse(content_node_child)
|
48
|
+
when 'extent'
|
49
|
+
@object_size = OOXMLCoordinates.parse(content_node_child, x_attr: 'cx', y_attr: 'cy', unit: :emu)
|
50
|
+
when 'positionV'
|
51
|
+
@vertical_position = DocxDrawingPosition.new(parent: self).parse(content_node_child)
|
52
|
+
when 'positionH'
|
53
|
+
@horizontal_position = DocxDrawingPosition.new(parent: self).parse(content_node_child)
|
54
|
+
when 'sizeRelH'
|
55
|
+
@size_relative_horizontal = SizeRelativeHorizontal.new(parent: self).parse(content_node_child)
|
56
|
+
when 'sizeRelV'
|
57
|
+
@size_relative_vertical = SizeRelativeVertical.new(parent: self).parse(content_node_child)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
self
|
61
|
+
end
|
15
62
|
end
|
16
63
|
end
|
@@ -10,8 +10,18 @@ require_relative 'custom_geometry/ooxml_custom_geometry'
|
|
10
10
|
module OoxmlParser
|
11
11
|
# DOCX Shape Properties
|
12
12
|
class DocxShapeProperties < OOXMLDocumentObject
|
13
|
-
|
14
|
-
|
13
|
+
# @return [DocxShapeSize] size of shape
|
14
|
+
attr_reader :shape_size
|
15
|
+
# @return [PresetGeometry] preset geometry of object
|
16
|
+
attr_reader :preset_geometry
|
17
|
+
# @return [DocxColor] color of object
|
18
|
+
attr_reader :fill_color
|
19
|
+
# @return [DocxShapeLine] line info
|
20
|
+
attr_reader :line
|
21
|
+
# @return [PresetGeometry] is some geometry custom
|
22
|
+
attr_reader :custom_geometry
|
23
|
+
# @return [BlipFill] BlipFill data
|
24
|
+
attr_reader :blip_fill
|
15
25
|
|
16
26
|
alias transform shape_size
|
17
27
|
alias fill fill_color
|
@@ -3,9 +3,16 @@
|
|
3
3
|
module OoxmlParser
|
4
4
|
# Docx Shape Size
|
5
5
|
class DocxShapeSize < OOXMLDocumentObject
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
# @return [OoxmlSize] rotation info
|
7
|
+
attr_reader :rotation
|
8
|
+
# @return [OOXMLCoordinates] offset info
|
9
|
+
attr_reader :offset
|
10
|
+
# @return [OOXMLCoordinates] extent info
|
11
|
+
attr_reader :extent
|
12
|
+
# @return [OOXMLCoordinates] child offset
|
13
|
+
attr_reader :child_offset
|
14
|
+
# @return [OOXMLCoordinates] child extent
|
15
|
+
attr_reader :child_extent
|
9
16
|
# @return [True, False] is image flipped horizontally
|
10
17
|
attr_reader :flip_horizontal
|
11
18
|
# @return [True, False] is image flipped vertically
|
@@ -12,79 +12,6 @@ module OoxmlParser
|
|
12
12
|
# Class for Color in RGB
|
13
13
|
class Color < OOXMLDocumentObject
|
14
14
|
include ColorHelper
|
15
|
-
# @return [Array] Deprecated Indexed colors
|
16
|
-
# List of color duplicated from `OpenXML Sdk IndexedColors` class
|
17
|
-
# See https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.indexedcolors.aspx
|
18
|
-
COLOR_INDEXED =
|
19
|
-
%w[
|
20
|
-
000000
|
21
|
-
FFFFFF
|
22
|
-
FF0000
|
23
|
-
00FF00
|
24
|
-
0000FF
|
25
|
-
FFFF00
|
26
|
-
FF00FF
|
27
|
-
00FFFF
|
28
|
-
000000
|
29
|
-
FFFFFF
|
30
|
-
FF0000
|
31
|
-
00FF00
|
32
|
-
0000FF
|
33
|
-
FFFF00
|
34
|
-
FF00FF
|
35
|
-
00FFFF
|
36
|
-
800000
|
37
|
-
008000
|
38
|
-
000080
|
39
|
-
808000
|
40
|
-
800080
|
41
|
-
008080
|
42
|
-
C0C0C0
|
43
|
-
808080
|
44
|
-
9999FF
|
45
|
-
993366
|
46
|
-
FFFFCC
|
47
|
-
CCFFFF
|
48
|
-
660066
|
49
|
-
FF8080
|
50
|
-
0066CC
|
51
|
-
CCCCFF
|
52
|
-
000080
|
53
|
-
FF00FF
|
54
|
-
FFFF00
|
55
|
-
00FFFF
|
56
|
-
800080
|
57
|
-
800000
|
58
|
-
008080
|
59
|
-
0000FF
|
60
|
-
00CCFF
|
61
|
-
CCFFFF
|
62
|
-
CCFFCC
|
63
|
-
FFFF99
|
64
|
-
99CCFF
|
65
|
-
FF99CC
|
66
|
-
CC99FF
|
67
|
-
FFCC99
|
68
|
-
3366FF
|
69
|
-
33CCCC
|
70
|
-
99CC00
|
71
|
-
FFCC00
|
72
|
-
FF9900
|
73
|
-
FF6600
|
74
|
-
666699
|
75
|
-
969696
|
76
|
-
003366
|
77
|
-
339966
|
78
|
-
003300
|
79
|
-
333300
|
80
|
-
993300
|
81
|
-
993366
|
82
|
-
333399
|
83
|
-
333333
|
84
|
-
n/a
|
85
|
-
n/a
|
86
|
-
].freeze
|
87
|
-
|
88
15
|
# @return [Integer] Value of Red Part
|
89
16
|
attr_accessor :red
|
90
17
|
# @return [Integer] Value of Green Part
|
@@ -103,7 +30,7 @@ module OoxmlParser
|
|
103
30
|
|
104
31
|
alias set_alpha_channel alpha_channel=
|
105
32
|
|
106
|
-
|
33
|
+
# @return [ColorProperties] properties of color
|
107
34
|
attr_accessor :properties
|
108
35
|
|
109
36
|
# Value of color if non selected
|
@@ -320,12 +247,19 @@ module OoxmlParser
|
|
320
247
|
# @param index [Integer] index to get
|
321
248
|
# @return [Color] color by it's index
|
322
249
|
def get_rgb_by_color_index(index)
|
323
|
-
color_by_index =
|
250
|
+
color_by_index = color_indexes[index]
|
324
251
|
return :unknown if color_by_index.nil?
|
325
252
|
|
326
253
|
color_by_index == 'n/a' ? Color.new : Color.new.parse_hex_string(color_by_index)
|
327
254
|
end
|
328
255
|
|
256
|
+
# @return [Array] Deprecated Indexed colors
|
257
|
+
# List of color duplicated from `OpenXML Sdk IndexedColors` class
|
258
|
+
# See https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.indexedcolors.aspx
|
259
|
+
def color_indexes
|
260
|
+
@color_indexes ||= File.readlines("#{__dir__}/color/color_indexes.list", chomp: true)
|
261
|
+
end
|
262
|
+
|
329
263
|
# Parse color from string
|
330
264
|
# @param str [String] string to parse
|
331
265
|
# @return [Color] result of parsing
|
@@ -9,15 +9,16 @@ module OoxmlParser
|
|
9
9
|
return self if %w[auto null].include?(hex_string)
|
10
10
|
|
11
11
|
char_array = hex_string.split(//)
|
12
|
-
|
12
|
+
case char_array.length
|
13
|
+
when 3
|
13
14
|
@red = char_array[0].hex
|
14
15
|
@green = char_array[1].hex
|
15
16
|
@blue = char_array[2].hex
|
16
|
-
|
17
|
+
when 6
|
17
18
|
@red = (char_array[0] + char_array[1]).hex
|
18
19
|
@green = (char_array[2] + char_array[3]).hex
|
19
20
|
@blue = (char_array[4] + char_array[5]).hex
|
20
|
-
|
21
|
+
when 8
|
21
22
|
@alpha_channel = (char_array[0] + char_array[1]).hex
|
22
23
|
@red = (char_array[2] + char_array[3]).hex
|
23
24
|
@green = (char_array[4] + char_array[5]).hex
|
@@ -0,0 +1,66 @@
|
|
1
|
+
000000
|
2
|
+
FFFFFF
|
3
|
+
FF0000
|
4
|
+
00FF00
|
5
|
+
0000FF
|
6
|
+
FFFF00
|
7
|
+
FF00FF
|
8
|
+
00FFFF
|
9
|
+
000000
|
10
|
+
FFFFFF
|
11
|
+
FF0000
|
12
|
+
00FF00
|
13
|
+
0000FF
|
14
|
+
FFFF00
|
15
|
+
FF00FF
|
16
|
+
00FFFF
|
17
|
+
800000
|
18
|
+
008000
|
19
|
+
000080
|
20
|
+
808000
|
21
|
+
800080
|
22
|
+
008080
|
23
|
+
C0C0C0
|
24
|
+
808080
|
25
|
+
9999FF
|
26
|
+
993366
|
27
|
+
FFFFCC
|
28
|
+
CCFFFF
|
29
|
+
660066
|
30
|
+
FF8080
|
31
|
+
0066CC
|
32
|
+
CCCCFF
|
33
|
+
000080
|
34
|
+
FF00FF
|
35
|
+
FFFF00
|
36
|
+
00FFFF
|
37
|
+
800080
|
38
|
+
800000
|
39
|
+
008080
|
40
|
+
0000FF
|
41
|
+
00CCFF
|
42
|
+
CCFFFF
|
43
|
+
CCFFCC
|
44
|
+
FFFF99
|
45
|
+
99CCFF
|
46
|
+
FF99CC
|
47
|
+
CC99FF
|
48
|
+
FFCC99
|
49
|
+
3366FF
|
50
|
+
33CCCC
|
51
|
+
99CC00
|
52
|
+
FFCC00
|
53
|
+
FF9900
|
54
|
+
FF6600
|
55
|
+
666699
|
56
|
+
969696
|
57
|
+
003366
|
58
|
+
339966
|
59
|
+
003300
|
60
|
+
333300
|
61
|
+
993300
|
62
|
+
993366
|
63
|
+
333399
|
64
|
+
333333
|
65
|
+
n/a
|
66
|
+
n/a
|
@@ -3,8 +3,14 @@
|
|
3
3
|
module OoxmlParser
|
4
4
|
# Class for color transformations
|
5
5
|
class ColorProperties < OOXMLDocumentObject
|
6
|
-
|
7
|
-
|
6
|
+
# @return [Integer] alpha value of color
|
7
|
+
attr_reader :alpha
|
8
|
+
# @return [Float] luminance modulation value
|
9
|
+
attr_reader :luminance_modulation
|
10
|
+
# @return [Float] luminance offset value
|
11
|
+
attr_reader :luminance_offset
|
12
|
+
# @return [Float] tint value
|
13
|
+
attr_reader :tint
|
8
14
|
|
9
15
|
# Parse ColorProperties object
|
10
16
|
# @param node [Nokogiri::XML:Element] node to parse
|
@@ -3,9 +3,20 @@
|
|
3
3
|
module OoxmlParser
|
4
4
|
# Class for parsing `hlinkClick`, `hyperlink` tags
|
5
5
|
class Hyperlink < OOXMLDocumentObject
|
6
|
-
|
7
|
-
attr_accessor :
|
8
|
-
|
6
|
+
# @return [OOXMLDocumentObject] url of hyperlink
|
7
|
+
attr_accessor :url
|
8
|
+
# @return [String] tooltip value
|
9
|
+
attr_reader :tooltip
|
10
|
+
# @return [Coordinates] coordinates of link
|
11
|
+
attr_reader :coordinates
|
12
|
+
# @return [True, False] should click be highlighted
|
13
|
+
attr_reader :highlight_click
|
14
|
+
# @return [Symbol] type of action
|
15
|
+
attr_reader :action
|
16
|
+
# @return [String] value of action link
|
17
|
+
attr_reader :action_link
|
18
|
+
# @return [String] id of link
|
19
|
+
attr_reader :id
|
9
20
|
# @return [Array<ParagraphRun>] run of paragraph
|
10
21
|
attr_reader :runs
|
11
22
|
|
@@ -43,9 +43,13 @@ module OoxmlParser
|
|
43
43
|
end
|
44
44
|
|
45
45
|
class << self
|
46
|
+
# @return [String] path to root subfolder
|
46
47
|
attr_accessor :root_subfolder
|
48
|
+
# @return [PresentationTheme] list of themes
|
47
49
|
attr_accessor :theme
|
50
|
+
# @return [Array<String>] stack of xmls
|
48
51
|
attr_accessor :xmls_stack
|
52
|
+
# @return [String] path to root folder
|
49
53
|
attr_accessor :path_to_folder
|
50
54
|
|
51
55
|
# @param path_to_file [String] file
|
@@ -9,12 +9,34 @@ require_relative 'run_properties/shade'
|
|
9
9
|
module OoxmlParser
|
10
10
|
# Data about `rPr` object
|
11
11
|
class RunProperties < OOXMLDocumentObject
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
# @return [FontStyle] font style of run
|
13
|
+
attr_accessor :font_style
|
14
|
+
# @return [Color, DocxColorScheme] color of run
|
15
|
+
attr_reader :font_color
|
16
|
+
# @return [OoxmlSize] space size
|
17
|
+
attr_reader :space
|
18
|
+
# @return [string] name of font
|
19
|
+
attr_reader :font_name
|
20
|
+
# @return [Float] font size
|
21
|
+
attr_reader :font_size
|
22
|
+
# @return [Symbol] baseline of run
|
23
|
+
attr_reader :baseline
|
24
|
+
# @return [Hyperlink] hyperlink of run
|
25
|
+
attr_reader :hyperlink
|
26
|
+
# @return [Symbol] caps data
|
27
|
+
attr_reader :caps
|
28
|
+
# @return [Symbol] vertical align data
|
29
|
+
attr_reader :vertical_align
|
30
|
+
# @return [Outline] outline data
|
31
|
+
attr_reader :outline
|
32
|
+
# @return [True, False] is text shadow
|
33
|
+
attr_reader :shadow
|
34
|
+
# @return [True, False] is text emboss
|
35
|
+
attr_reader :emboss
|
36
|
+
# @return [True, False] is text vanish
|
37
|
+
attr_reader :vanish
|
38
|
+
# @return [True, False] is text rtl
|
39
|
+
attr_reader :rtl
|
18
40
|
# @return [Size] get run size
|
19
41
|
attr_accessor :size
|
20
42
|
# @return [RunSpacing] get run spacing
|
data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb
CHANGED
@@ -4,8 +4,10 @@
|
|
4
4
|
module OoxmlParser
|
5
5
|
# Class for parsing `w:ln` tags
|
6
6
|
class Outline < OOXMLDocumentObject
|
7
|
-
|
8
|
-
|
7
|
+
# @return [OoxmlSize] width of outline
|
8
|
+
attr_reader :width
|
9
|
+
# @return [DocxColorScheme] color of outline
|
10
|
+
attr_reader :color_scheme
|
9
11
|
|
10
12
|
def initialize(parent: nil)
|
11
13
|
@width = OoxmlSize.new(0)
|
@@ -15,9 +15,10 @@ module OoxmlParser
|
|
15
15
|
# @param other [Object] any other object
|
16
16
|
# @return [True, False] result of comparision
|
17
17
|
def ==(other)
|
18
|
-
|
18
|
+
case other
|
19
|
+
when Underline
|
19
20
|
@style.to_sym == other.style.to_sym && @color == other.color
|
20
|
-
|
21
|
+
when Symbol
|
21
22
|
@style.to_sym == other
|
22
23
|
else
|
23
24
|
false
|
@@ -18,12 +18,23 @@ module OoxmlParser
|
|
18
18
|
class DocumentStructure < CommonDocumentStructure
|
19
19
|
include DocumentStyleHelper
|
20
20
|
include DocumentStructureHelpers
|
21
|
-
|
22
|
-
|
21
|
+
# @return [Array<OOXMLDocumentObject>] list of elements
|
22
|
+
attr_accessor :elements
|
23
|
+
# @return [PageProperties] properties of document
|
24
|
+
attr_accessor :page_properties
|
25
|
+
# @return [Note] notes of document
|
26
|
+
attr_accessor :notes
|
27
|
+
# @return [DocumentBackground] background of document
|
28
|
+
attr_accessor :background
|
29
|
+
# @return [DocumentProperties] properties of document
|
30
|
+
attr_accessor :document_properties
|
31
|
+
# @return [Comments] comment of document
|
32
|
+
attr_accessor :comments
|
23
33
|
# @return [Numbering] store numbering data
|
24
34
|
attr_accessor :numbering
|
25
35
|
# @return [Styles] styles of document
|
26
36
|
attr_accessor :styles
|
37
|
+
# @return [PresentationTheme] theme of docx
|
27
38
|
attr_accessor :theme
|
28
39
|
# @return [Relationships] relationships
|
29
40
|
attr_accessor :relationships
|
@@ -273,10 +284,7 @@ module OoxmlParser
|
|
273
284
|
end
|
274
285
|
|
275
286
|
class << self
|
276
|
-
attr_accessor :default_table_run_style
|
277
|
-
attr_accessor :default_table_paragraph_style
|
278
|
-
attr_accessor :default_paragraph_style
|
279
|
-
attr_accessor :default_run_style
|
287
|
+
attr_accessor :default_table_run_style, :default_table_paragraph_style, :default_paragraph_style, :default_run_style
|
280
288
|
end
|
281
289
|
end
|
282
290
|
end
|
@@ -71,14 +71,10 @@ module OoxmlParser
|
|
71
71
|
# @return [Array<OOXMLDocumentObject>] array of child objects that contains data
|
72
72
|
def nonempty_runs
|
73
73
|
@character_style_array.select do |cur_run|
|
74
|
-
|
74
|
+
case cur_run
|
75
|
+
when DocxParagraphRun, ParagraphRun
|
75
76
|
!cur_run.empty?
|
76
|
-
|
77
|
-
cur_run.is_a?(StructuredDocumentTag) ||
|
78
|
-
cur_run.is_a?(BookmarkStart) ||
|
79
|
-
cur_run.is_a?(BookmarkEnd) ||
|
80
|
-
cur_run.is_a?(CommentRangeStart) ||
|
81
|
-
cur_run.is_a?(CommentRangeEnd)
|
77
|
+
when DocxFormula, StructuredDocumentTag, BookmarkStart, BookmarkEnd, CommentRangeStart, CommentRangeEnd
|
82
78
|
true
|
83
79
|
end
|
84
80
|
end
|
@@ -25,8 +25,8 @@ module OoxmlParser
|
|
25
25
|
# Convert to string
|
26
26
|
# @return [String] result of conversion
|
27
27
|
def to_s
|
28
|
-
"first line indent: #{@first_line_indent}, left indent: #{@left_indent},
|
29
|
-
|
28
|
+
"first line indent: #{@first_line_indent}, left indent: #{@left_indent}, "\
|
29
|
+
"right indent: #{@right_indent}, hanging indent: #{@hanging_indent}"
|
30
30
|
end
|
31
31
|
|
32
32
|
# Parse Indents
|
@@ -3,8 +3,14 @@
|
|
3
3
|
module OoxmlParser
|
4
4
|
# Class Header Footer classes
|
5
5
|
class HeaderFooter < OOXMLDocumentObject
|
6
|
-
|
7
|
-
|
6
|
+
# @return [Integer] id of header-footer
|
7
|
+
attr_reader :id
|
8
|
+
# @return [Array<OOXMLDocumentObject>] list of elements if object
|
9
|
+
attr_reader :elements
|
10
|
+
# @return [Symbol] `:header` or `:footer`
|
11
|
+
attr_reader :type
|
12
|
+
# @return [String] suffix for object files
|
13
|
+
attr_reader :path_suffix
|
8
14
|
|
9
15
|
def initialize(type = :header, parent: nil)
|
10
16
|
@type = type
|
@@ -4,10 +4,12 @@ require_relative 'columns/column'
|
|
4
4
|
module OoxmlParser
|
5
5
|
# Class for data of Columns
|
6
6
|
class Columns < OOXMLDocumentObject
|
7
|
+
# @return [Integer] count of columns
|
7
8
|
attr_accessor :count
|
9
|
+
# @return [True, False] is columns are equal width
|
8
10
|
attr_accessor :equal_width
|
9
|
-
|
10
11
|
alias equal_width? equal_width
|
12
|
+
# @return [Array<Column>] list of colujmns
|
11
13
|
attr_accessor :column_array
|
12
14
|
# @return [Boolean] Draw Line Between Columns
|
13
15
|
attr_reader :separator
|
@@ -26,10 +26,11 @@ module OoxmlParser
|
|
26
26
|
doc.search(xpath_note).each do |ftr|
|
27
27
|
number = 0
|
28
28
|
ftr.xpath('*').each do |sub_element|
|
29
|
-
|
29
|
+
case sub_element.name
|
30
|
+
when 'p'
|
30
31
|
note.elements << params[:default_paragraph].dup.parse(sub_element, number, params[:default_character], parent: note)
|
31
32
|
number += 1
|
32
|
-
|
33
|
+
when 'tbl'
|
33
34
|
note.elements << Table.new(parent: note).parse(sub_element, number)
|
34
35
|
number += 1
|
35
36
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
require_relative 'slide/presentation_alternate_content'
|
4
4
|
require_relative 'slide/background'
|
5
5
|
require_relative 'slide/common_slide_data'
|
6
|
-
require_relative 'slide/connection_shape
|
7
|
-
require_relative 'slide/presentation_notes
|
6
|
+
require_relative 'slide/connection_shape'
|
7
|
+
require_relative 'slide/presentation_notes'
|
8
8
|
require_relative 'slide/graphic_frame/graphic_frame'
|
9
9
|
require_relative 'slide/slide/shapes_grouping'
|
10
10
|
require_relative 'slide/slide/timing'
|
data/lib/ooxml_parser/version.rb
CHANGED
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.8.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: 2020-07-
|
13
|
+
date: 2020-07-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -80,28 +80,28 @@ dependencies:
|
|
80
80
|
requirements:
|
81
81
|
- - '='
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.
|
83
|
+
version: 0.88.0
|
84
84
|
type: :development
|
85
85
|
prerelease: false
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - '='
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 0.
|
90
|
+
version: 0.88.0
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rubocop-performance
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - '='
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 1.7.
|
97
|
+
version: 1.7.1
|
98
98
|
type: :development
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - '='
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 1.7.
|
104
|
+
version: 1.7.1
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: rubocop-rake
|
107
107
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,6 +220,7 @@ files:
|
|
220
220
|
- lib/ooxml_parser/common_parser/common_data/borders_properties.rb
|
221
221
|
- lib/ooxml_parser/common_parser/common_data/color.rb
|
222
222
|
- lib/ooxml_parser/common_parser/common_data/color/color_helper.rb
|
223
|
+
- lib/ooxml_parser/common_parser/common_data/color/color_indexes.list
|
223
224
|
- lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb
|
224
225
|
- lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb
|
225
226
|
- lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb
|