ooxml_parser 0.8.1 → 0.12.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/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 +1 -1
- 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 +1 -1
- 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/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 +7 -11
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +29 -0
- 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 +8 -1
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +1 -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 +6 -4
- 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 +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +14 -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 +5 -9
- 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/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 +1 -1
- 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 +2 -2
- 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 +6 -10
- 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_helper.rb +7 -0
- 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 +2 -2
- 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 +1 -1
- 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 +1 -1
- 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 +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +1 -0
- 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 +1 -1
- 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/slide_helper.rb +1 -3
- 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/version.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +17 -3
- 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/pivot_cache/pivot_cache_definition.rb +6 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field/shared_items.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition.rb +114 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items/column_row_item.rb +22 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/location.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items/item.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_table_style_info.rb +42 -0
- 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/fills/fill.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 +111 -36
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +0 -28
@@ -8,11 +8,7 @@ module OoxmlParser
|
|
8
8
|
left = OoxmlSize.new(0),
|
9
9
|
right = OoxmlSize.new(0),
|
10
10
|
parent: nil)
|
11
|
-
|
12
|
-
@bottom = bottom
|
13
|
-
@left = left
|
14
|
-
@right = right
|
15
|
-
@parent = parent
|
11
|
+
super(true, top, bottom, left, right, parent: parent)
|
16
12
|
end
|
17
13
|
|
18
14
|
# Parse ParagraphMargins object
|
@@ -11,7 +11,7 @@ module OoxmlParser
|
|
11
11
|
@bottom = bottom
|
12
12
|
@left = left
|
13
13
|
@right = right
|
14
|
-
|
14
|
+
super(parent: parent)
|
15
15
|
end
|
16
16
|
|
17
17
|
# TODO: Separate @is_default attribute and remove this method
|
@@ -29,7 +29,7 @@ module OoxmlParser
|
|
29
29
|
|
30
30
|
# @return [String] result of convert of object to string
|
31
31
|
def to_s
|
32
|
-
|
32
|
+
"Default: #{is_default} top: #{@top}, bottom: #{@bottom}, left: #{@left}, right: #{@right}"
|
33
33
|
end
|
34
34
|
|
35
35
|
# Parse TableMargins object
|
@@ -10,15 +10,9 @@ module OoxmlParser
|
|
10
10
|
|
11
11
|
def initialize(parent: nil)
|
12
12
|
@type = 'horizontal'
|
13
|
-
|
13
|
+
super
|
14
14
|
end
|
15
15
|
|
16
|
-
alias count_of_merged_cells value
|
17
|
-
|
18
|
-
extend Gem::Deprecate
|
19
|
-
deprecate :type, 'GridSpan always horizontal', 2069, 1
|
20
|
-
deprecate :count_of_merged_cells, 'value', 2069, 1
|
21
|
-
|
22
16
|
# Parse Grid Span data
|
23
17
|
# @param [Nokogiri::XML:Element] node with GridSpan data
|
24
18
|
# @return [GridSpan] value of GridSpan
|
@@ -180,7 +180,7 @@ module OoxmlParser
|
|
180
180
|
case element.name
|
181
181
|
when 'p'
|
182
182
|
child = element.child
|
183
|
-
unless child.nil? && doc_structure.elements.last.
|
183
|
+
unless child.nil? && doc_structure.elements.last.instance_of?(Table)
|
184
184
|
paragraph_style = DocumentStructure.default_paragraph_style.dup.parse(element, number, DocumentStructure.default_run_style, parent: doc_structure)
|
185
185
|
number += 1
|
186
186
|
doc_structure.elements << paragraph_style.dup
|
@@ -217,7 +217,7 @@ module OoxmlParser
|
|
217
217
|
# Parse default style
|
218
218
|
# @return [void]
|
219
219
|
def parse_default_style
|
220
|
-
doc = parse_xml(OOXMLDocumentObject.path_to_folder
|
220
|
+
doc = parse_xml("#{OOXMLDocumentObject.path_to_folder}word/styles.xml")
|
221
221
|
doc.search('//w:style').each do |style|
|
222
222
|
next if style.attribute('default').nil?
|
223
223
|
|
@@ -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)
|
@@ -18,7 +18,7 @@ module OoxmlParser
|
|
18
18
|
# Class for data of DocxParagraph
|
19
19
|
class DocxParagraph < OOXMLDocumentObject
|
20
20
|
include DocxParagraphHelper
|
21
|
-
attr_accessor :number, :bookmark_start, :bookmark_end, :align, :spacing, :
|
21
|
+
attr_accessor :number, :bookmark_start, :bookmark_end, :align, :spacing, :ind, :numbering,
|
22
22
|
:character_style_array, :page_break, :borders, :keep_lines,
|
23
23
|
:contextual_spacing, :sector_properties, :page_numbering, :section_break, :style, :keep_next,
|
24
24
|
:orphan_control
|
@@ -41,7 +41,7 @@ module OoxmlParser
|
|
41
41
|
@number = 0
|
42
42
|
@bookmark_start = []
|
43
43
|
@bookmark_end = []
|
44
|
-
@align =
|
44
|
+
@align = :left
|
45
45
|
@spacing = Spacing.new
|
46
46
|
@ind = Indents.new
|
47
47
|
@character_style_array = []
|
@@ -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
|
@@ -129,8 +129,8 @@ module OoxmlParser
|
|
129
129
|
when 'bookmarkEnd'
|
130
130
|
character_styles_array << BookmarkEnd.new(parent: self).parse(node_child)
|
131
131
|
when 'pPr'
|
132
|
-
parse_paragraph_style(node_child, custom_character_style)
|
133
132
|
@paragraph_properties = ParagraphProperties.new(parent: self).parse(node_child)
|
133
|
+
parse_paragraph_style(node_child, custom_character_style)
|
134
134
|
when 'commentRangeStart'
|
135
135
|
character_styles_array << CommentRangeStart.new(parent: self).parse(node_child)
|
136
136
|
when 'commentRangeEnd'
|
@@ -177,7 +177,7 @@ module OoxmlParser
|
|
177
177
|
end
|
178
178
|
end
|
179
179
|
@number = par_number
|
180
|
-
character_styles_array.last.text = character_styles_array.last.text.rstrip if character_styles_array.last.
|
180
|
+
character_styles_array.last.text = character_styles_array.last.text.rstrip if character_styles_array.last.instance_of?(DocxParagraphRun)
|
181
181
|
@character_style_array = character_styles_array
|
182
182
|
@parent = parent
|
183
183
|
self
|
@@ -206,10 +206,6 @@ module OoxmlParser
|
|
206
206
|
@keep_next = true
|
207
207
|
when 'contextualSpacing'
|
208
208
|
@contextual_spacing = true
|
209
|
-
when 'shd'
|
210
|
-
background_color_string = node_child.attribute('fill').value
|
211
|
-
@background_color = Color.new(parent: self).parse_hex_string(background_color_string)
|
212
|
-
@background_color.set_style(node_child.attribute('val').value.to_sym) unless node_child.attribute('val').nil?
|
213
209
|
when 'pStyle'
|
214
210
|
parse_paragraph_style_xml(node_child.attribute('val').value, default_char_style)
|
215
211
|
when 'ind'
|
@@ -247,7 +243,7 @@ module OoxmlParser
|
|
247
243
|
# @param character_style [DocxParagraphRun] style to parse
|
248
244
|
# @return [void]
|
249
245
|
def parse_paragraph_style_xml(id, character_style)
|
250
|
-
doc = parse_xml(OOXMLDocumentObject.path_to_folder
|
246
|
+
doc = parse_xml("#{OOXMLDocumentObject.path_to_folder}word/styles.xml")
|
251
247
|
doc.search('//w:style').each do |style|
|
252
248
|
next unless style.attribute('styleId').value == id
|
253
249
|
|
@@ -9,5 +9,12 @@ module OoxmlParser
|
|
9
9
|
|
10
10
|
root_object.comments_extended.by_id(@paragraph_id)
|
11
11
|
end
|
12
|
+
|
13
|
+
# Temp method to return background color
|
14
|
+
# Need to be compatible with older versions
|
15
|
+
# @return [OoxmlParser::Color]
|
16
|
+
def background_color
|
17
|
+
paragraph_properties.shade.to_background_color
|
18
|
+
end
|
12
19
|
end
|
13
20
|
end
|
@@ -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
|