ooxml_parser 0.7.1 → 0.9.1
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/chart/chart.rb +55 -48
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area/common_chart_data.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/number_string_cache.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +6 -10
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +4 -6
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +4 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +2 -21
- 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/drawing_properties/docx_wrap_drawing.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +0 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb +0 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +0 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +0 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +0 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb +1 -1
- 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 +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +13 -3
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list.rb +1 -1
- 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/alternate_content/picture/group/old_docx_group.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/color.rb +11 -77
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +33 -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/colors/hsl_color.rb +0 -33
- data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/content_types.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +15 -4
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +5 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +31 -9
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +5 -3
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/relationships.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +1 -5
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb +1 -7
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +4 -3
- data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_document_structure.rb +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +15 -7
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments.rb +2 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended.rb +2 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +5 -9
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +38 -21
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +3 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +5 -8
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +9 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +2 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +4 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +4 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +2 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +2 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +1 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +3 -3
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +2 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition_list.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/table_styles.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +1 -1
- data/lib/ooxml_parser/version.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/cell_style/alignment.rb +5 -5
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/comment_list.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +1 -1
- metadata +9 -9
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +0 -28
@@ -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
|
@@ -206,7 +217,7 @@ module OoxmlParser
|
|
206
217
|
# Parse default style
|
207
218
|
# @return [void]
|
208
219
|
def parse_default_style
|
209
|
-
doc = parse_xml(OOXMLDocumentObject.path_to_folder
|
220
|
+
doc = parse_xml("#{OOXMLDocumentObject.path_to_folder}word/styles.xml")
|
210
221
|
doc.search('//w:style').each do |style|
|
211
222
|
next if style.attribute('default').nil?
|
212
223
|
|
@@ -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
|
@@ -9,8 +9,8 @@ module OoxmlParser
|
|
9
9
|
|
10
10
|
def initialize(params = {})
|
11
11
|
@comments_array = []
|
12
|
-
@
|
13
|
-
|
12
|
+
@file = params.fetch(:file, "#{OOXMLDocumentObject.path_to_folder}word/comments.xml")
|
13
|
+
super(parent: params[:parent])
|
14
14
|
end
|
15
15
|
|
16
16
|
# @return [Comment] accessor
|
@@ -6,7 +6,7 @@ module OoxmlParser
|
|
6
6
|
class CommentsExtended < OOXMLDocumentObject
|
7
7
|
def initialize(parent: nil)
|
8
8
|
@comments_extended_array = []
|
9
|
-
|
9
|
+
super
|
10
10
|
end
|
11
11
|
|
12
12
|
# @return [Array, CommentsExtended] accessor
|
@@ -17,7 +17,7 @@ module OoxmlParser
|
|
17
17
|
# Parse CommentsExtended object
|
18
18
|
# @return [CommentsExtended] result of parsing
|
19
19
|
def parse
|
20
|
-
file_to_parse = OOXMLDocumentObject.path_to_folder
|
20
|
+
file_to_parse = "#{OOXMLDocumentObject.path_to_folder}word/commentsExtended.xml"
|
21
21
|
return nil unless File.exist?(file_to_parse)
|
22
22
|
|
23
23
|
doc = parse_xml(file_to_parse)
|
@@ -9,7 +9,7 @@ module OoxmlParser
|
|
9
9
|
# Parse Settings object
|
10
10
|
# @return [DocumentSettings] result of parsing
|
11
11
|
def parse
|
12
|
-
settings_path = OOXMLDocumentObject.path_to_folder
|
12
|
+
settings_path = "#{OOXMLDocumentObject.path_to_folder}word/settings.xml"
|
13
13
|
return nil unless File.exist?(settings_path)
|
14
14
|
|
15
15
|
doc = parse_xml(settings_path)
|
@@ -52,7 +52,7 @@ module OoxmlParser
|
|
52
52
|
@page_numbering = false
|
53
53
|
@keep_next = false
|
54
54
|
@orphan_control = true
|
55
|
-
|
55
|
+
super
|
56
56
|
end
|
57
57
|
|
58
58
|
alias elements character_style_array
|
@@ -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
|
@@ -251,7 +247,7 @@ module OoxmlParser
|
|
251
247
|
# @param character_style [DocxParagraphRun] style to parse
|
252
248
|
# @return [void]
|
253
249
|
def parse_paragraph_style_xml(id, character_style)
|
254
|
-
doc = parse_xml(OOXMLDocumentObject.path_to_folder
|
250
|
+
doc = parse_xml("#{OOXMLDocumentObject.path_to_folder}word/styles.xml")
|
255
251
|
doc.search('//w:style').each do |style|
|
256
252
|
next unless style.attribute('styleId').value == id
|
257
253
|
|
@@ -51,33 +51,14 @@ module OoxmlParser
|
|
51
51
|
when 'smallCaps'
|
52
52
|
self.caps = :small_caps if option_enabled?(node_child)
|
53
53
|
when 'color'
|
54
|
-
node_child
|
55
|
-
case key
|
56
|
-
when 'val'
|
57
|
-
self.font_color = Color.new(parent: self).parse_hex_string(value.value)
|
58
|
-
when 'themeColor'
|
59
|
-
if root_object.theme && root_object.theme.color_scheme[value.value.to_sym]
|
60
|
-
break if value.value == 'text2' || value.value == 'background2' || value.value.include?('accent') # Don't know why. Just works
|
61
|
-
|
62
|
-
self.font_color = root_object.theme.color_scheme[value.value.to_sym].color.dup
|
63
|
-
end
|
64
|
-
when 'themeShade'
|
65
|
-
font_color.calculate_with_shade!(value.value.hex.to_f / 255.0)
|
66
|
-
when 'themeTint'
|
67
|
-
font_color.calculate_with_tint!(1.0 - (value.value.hex.to_f / 255.0))
|
68
|
-
end
|
69
|
-
end
|
54
|
+
parse_color_tag(node_child)
|
70
55
|
when 'shd'
|
71
56
|
self.background_color = node_child.attribute('fill').value
|
72
57
|
unless node_child.attribute('fill').value == 'auto' || node_child.attribute('fill').value == '' || node_child.attribute('fill').value == 'null'
|
73
58
|
self.background_color = Color.new(parent: self).parse_hex_string(node_child.attribute('fill').value)
|
74
59
|
end
|
75
60
|
when 'u', 'uCs'
|
76
|
-
|
77
|
-
if option_enabled?(node_child)
|
78
|
-
font_style.underlined.style = node_child.attribute('val').value
|
79
|
-
font_style.underlined.color = Color.new(parent: font_style.underlined).parse_hex_string(node_child.attribute('color').value) unless node_child.attribute('color').nil?
|
80
|
-
end
|
61
|
+
parse_underline(node_child)
|
81
62
|
when 'strike'
|
82
63
|
font_style.strike = :single if option_enabled?(node_child)
|
83
64
|
when 'dstrike'
|
@@ -86,5 +67,41 @@ module OoxmlParser
|
|
86
67
|
end
|
87
68
|
self
|
88
69
|
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
# Parse `color` tag
|
74
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
75
|
+
# @return [nil]
|
76
|
+
def parse_color_tag(node)
|
77
|
+
node.attributes.each do |key, value|
|
78
|
+
case key
|
79
|
+
when 'val'
|
80
|
+
self.font_color = Color.new(parent: self).parse_hex_string(value.value)
|
81
|
+
when 'themeColor'
|
82
|
+
if root_object.theme && root_object.theme.color_scheme[value.value.to_sym]
|
83
|
+
break if value.value == 'text2' || value.value == 'background2' || value.value.include?('accent') # Don't know why. Just works
|
84
|
+
|
85
|
+
self.font_color = root_object.theme.color_scheme[value.value.to_sym].color.dup
|
86
|
+
end
|
87
|
+
when 'themeShade'
|
88
|
+
font_color.calculate_with_shade!(value.value.hex.to_f / 255.0)
|
89
|
+
when 'themeTint'
|
90
|
+
font_color.calculate_with_tint!(1.0 - (value.value.hex.to_f / 255.0))
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Parse `u` or `uCs` tag
|
96
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
97
|
+
# @return [nil]
|
98
|
+
def parse_underline(node)
|
99
|
+
font_style.underlined = Underline.new
|
100
|
+
|
101
|
+
return unless option_enabled?(node)
|
102
|
+
|
103
|
+
font_style.underlined.style = node.attribute('val').value
|
104
|
+
font_style.underlined.color = Color.new(parent: font_style.underlined).parse_hex_string(node.attribute('color').value) unless node.attribute('color').nil?
|
105
|
+
end
|
89
106
|
end
|
90
107
|
end
|
@@ -14,7 +14,7 @@ module OoxmlParser
|
|
14
14
|
@left_indent = left_indent
|
15
15
|
@right_indent = right_indent
|
16
16
|
@hanging_indent = hanging_indent
|
17
|
-
|
17
|
+
super(parent: parent)
|
18
18
|
end
|
19
19
|
|
20
20
|
alias first_line first_line_indent
|
@@ -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
|
data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb
CHANGED
@@ -5,14 +5,11 @@ module OoxmlParser
|
|
5
5
|
class StyleParametres < OOXMLDocumentObject
|
6
6
|
attr_accessor :q_format, :hidden, :name
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@q_format = q_format
|
14
|
-
@hidden = hidden
|
15
|
-
@parent = parent
|
8
|
+
def initialize(params = {})
|
9
|
+
@name = params[:name]
|
10
|
+
@q_format = params.fetch(:q_format, false)
|
11
|
+
@hidden = params.fetch(:hidden, false)
|
12
|
+
super(parent: params[:parent])
|
16
13
|
end
|
17
14
|
|
18
15
|
# Parse StyleParametres data
|
@@ -3,13 +3,19 @@
|
|
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
|
11
17
|
@elements = []
|
12
|
-
|
18
|
+
super(parent: parent)
|
13
19
|
end
|
14
20
|
|
15
21
|
# @return [String] string for search of xpath
|
@@ -14,7 +14,7 @@ module OoxmlParser
|
|
14
14
|
def initialize(parent: nil)
|
15
15
|
@abstract_numbering_list = []
|
16
16
|
@numbering_definition_list = []
|
17
|
-
|
17
|
+
super
|
18
18
|
end
|
19
19
|
|
20
20
|
# Get properties by number id
|
@@ -38,7 +38,7 @@ module OoxmlParser
|
|
38
38
|
# Parse Numbering data
|
39
39
|
# @return [Numbering] result of parse
|
40
40
|
def parse
|
41
|
-
numbering_xml = OOXMLDocumentObject.path_to_folder
|
41
|
+
numbering_xml = "#{OOXMLDocumentObject.path_to_folder}word/numbering.xml"
|
42
42
|
return nil unless File.exist?(numbering_xml)
|
43
43
|
|
44
44
|
node = parse_xml(File.open(numbering_xml))
|