ooxml_parser 0.4.0 → 0.7.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.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/chart_style.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +39 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats/pivot_format.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area.rb +67 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area/common_chart_data.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +22 -9
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +5 -5
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/{string_reference.rb → number_string_reference.rb} +9 -7
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/{string_cache.rb → number_string_cache.rb} +11 -6
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point.rb +9 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point/text_value.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/x_y_values.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/view_3d.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis/scaling.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +7 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_point.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +6 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing/doc_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +5 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +12 -8
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +26 -14
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_horizontal.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_vertical.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +8 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +7 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties/shape_placeholder.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +3 -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/docx_shape/text_body.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties/preset_text_warp.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +5 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +4 -2
- 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 +2 -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 +2 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +6 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +4 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip/alpha_mod_fix.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry.rb +2 -0
- 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 +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list/shape_guide.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +12 -11
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +11 -5
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_element.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +3 -3
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +3 -3
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +25 -9
- data/lib/ooxml_parser/common_parser/common_data/color.rb +119 -71
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +25 -21
- data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +12 -3
- data/lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb +4 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +23 -8
- data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +6 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +5 -3
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +6 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +18 -14
- data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_default.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_override.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +18 -6
- data/lib/ooxml_parser/common_parser/common_data/font_style.rb +3 -2
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +42 -3
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +107 -116
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_object_attribute_helper.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +9 -16
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +9 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/text.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +5 -3
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +25 -35
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing/line_spacing.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/tab.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/relationships.rb +24 -19
- data/lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table.rb +5 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +6 -8
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +10 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_layout.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +10 -2
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +19 -17
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +8 -5
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_row_band_size.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +11 -11
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +27 -39
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line/line_join.rb +4 -4
- data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +5 -2
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties/table_row_height.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +5 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid/grid_column.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +26 -4
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties/table_borders.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +6 -0
- data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_document_structure.rb +17 -0
- data/lib/ooxml_parser/common_parser/parser.rb +6 -2
- data/lib/ooxml_parser/configuration.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +100 -41
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments.rb +36 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +37 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended.rb +4 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended/comment_extended.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +3 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +6 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb +2 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +11 -12
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +93 -82
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_end.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_start.rb +26 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_end.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_start.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties/argument_size.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +4 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_grow.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_limit_location.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +5 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +4 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_helper.rb +11 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +30 -23
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +15 -4
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +39 -8
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_margins.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_size.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/stroke.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb +41 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +6 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +5 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/structured_document_tag.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +3 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +4 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +12 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/multilevel_type.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +3 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_justification.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_text.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/numbering_format.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition.rb +4 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +7 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/footnote_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +16 -14
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +10 -8
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +5 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +14 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/paragraph_properties_default.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/run_properties_default.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_parser.rb +6 -0
- data/lib/ooxml_parser/helpers/string_helper.rb +3 -1
- data/lib/ooxml_parser/name.rb +9 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +32 -37
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors.rb +39 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors/comment_author.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb +33 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb +39 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_helpers.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +12 -3
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme.rb +36 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection.rb +31 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection/text_font.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +14 -8
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +11 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +4 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties/stretch.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/connection_shape.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +5 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +2 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_notes.rb +3 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +3 -9
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +7 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +6 -3
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/{condition.rb → codition_list/condition.rb} +3 -9
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition_list.rb +27 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +19 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +6 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb +5 -5
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +8 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties/wheel.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/table_styles.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +7 -1
- data/lib/ooxml_parser/version.rb +4 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +57 -38
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +6 -1
- 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/shared_string_table.rb +46 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table/string_index.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +15 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/{worksheet/xlsx_row/xlsx_cell → style_sheet/cell_xfs}/cell_style/alignment.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +150 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +4 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +5 -3
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +5 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +2 -5
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats/number_format.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders/xlsx_border.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb +3 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +56 -25
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +32 -29
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/author.rb +16 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/comment_list.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +10 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/ole_objects.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/page_setup.rb +105 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb +8 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb +12 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters/custom_filter.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns/table_column.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/worksheet_helper.rb +14 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +12 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +3 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +60 -27
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb +39 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +7 -1
- metadata +147 -29
- data/LICENSE.txt +0 -661
- data/README.md +0 -43
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/order.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_index.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point_count.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop/preset_color.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/language.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties/vertical_merge.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb +0 -30
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb +0 -28
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark.rb +0 -21
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/start.rb +0 -20
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition/abstract_numbering_id.rb +0 -20
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment.rb +0 -31
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb +0 -26
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style.rb +0 -128
@@ -1,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OoxmlParser
|
4
|
+
# Class for working with coordinates
|
2
5
|
class Coordinates
|
3
6
|
attr_accessor :row, :column, :list
|
4
7
|
|
@@ -26,10 +29,14 @@ module OoxmlParser
|
|
26
29
|
coordinates
|
27
30
|
end
|
28
31
|
|
32
|
+
# Parse range of coordinates
|
33
|
+
# @param arguments_string [String] data to parse
|
34
|
+
# @return [Array] result
|
29
35
|
def parser_coordinates_range(arguments_string)
|
30
36
|
return parse_coordinates_array(arguments_string) if arguments_string.include?(',')
|
31
37
|
return warn "Formulas with # is unsupported: #{arguments_string}" if arguments_string.include?('#')
|
32
38
|
return warn 'Formulas consists from `!` only' if arguments_string == '!'
|
39
|
+
|
33
40
|
sheet_name = 'Sheet1'
|
34
41
|
|
35
42
|
if arguments_string.include?('!')
|
@@ -68,8 +75,6 @@ module OoxmlParser
|
|
68
75
|
end
|
69
76
|
end
|
70
77
|
end
|
71
|
-
else
|
72
|
-
raise 'Wrong arguments format'
|
73
78
|
end
|
74
79
|
arguments_array
|
75
80
|
end
|
@@ -100,20 +105,23 @@ module OoxmlParser
|
|
100
105
|
# StringHelper.get_column_name('45') #=> "AS"
|
101
106
|
# StringHelper.get_column_name('287') #=> "KA"
|
102
107
|
def get_column_name(number)
|
103
|
-
(number.to_i
|
108
|
+
(number.to_i.positive? ? ('A'..'Z').to_a[(number.to_i - 1) % 26] + get_column_name((number.to_i - 1) / 26).reverse : '').reverse
|
104
109
|
end
|
105
110
|
end
|
106
111
|
|
107
|
-
# get_column_number -> integer
|
108
112
|
# @return [Integer] number of column
|
109
113
|
# This method takes @column string
|
110
114
|
# and converts into integer
|
111
|
-
def
|
115
|
+
def column_number
|
112
116
|
@column.reverse.each_char.reduce(0) do |result, char|
|
113
117
|
result + (char.downcase.ord - 96) * (26**@column.reverse.index(char))
|
114
118
|
end
|
115
119
|
end
|
116
120
|
|
121
|
+
alias get_column_number column_number
|
122
|
+
extend Gem::Deprecate
|
123
|
+
deprecate :get_column_number, 'column_number', 2020, 1
|
124
|
+
|
117
125
|
# Compares rows of two cells
|
118
126
|
# @param [Coordinates] other_cell other cell coordinates
|
119
127
|
# @return [true, false] true, if row greater, than other row
|
@@ -125,9 +133,10 @@ module OoxmlParser
|
|
125
133
|
# @param [Coordinates] other_cell other cell coordinates
|
126
134
|
# @return [true, false] true, if column greater, than other row
|
127
135
|
def column_greater_that_other?(other_cell)
|
128
|
-
|
136
|
+
column_number > other_cell.column_number
|
129
137
|
end
|
130
138
|
|
139
|
+
# @return [String] result of convert of object to string
|
131
140
|
def to_s
|
132
141
|
"#{@column}#{@row} #{@list ? "list: #{@list}" : ''}"
|
133
142
|
end
|
@@ -136,6 +145,9 @@ module OoxmlParser
|
|
136
145
|
@column.nil? && @list.nil? && @row.nil?
|
137
146
|
end
|
138
147
|
|
148
|
+
# Compare this object to other
|
149
|
+
# @param other [Object] any other object
|
150
|
+
# @return [True, False] result of comparision
|
139
151
|
def ==(other)
|
140
152
|
other.is_a?(Coordinates) ? (@row == other.row && @column == other.column) : false
|
141
153
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'underline'
|
2
4
|
# @author Pavel.Lobashov
|
3
|
-
# Class for working with font styles (bold,italic,underlined,strike)
|
4
|
-
# noinspection RubyClassMethodNamingConvention
|
5
5
|
module OoxmlParser
|
6
|
+
# Class for working with font styles (bold,italic,underlined,strike)
|
6
7
|
class FontStyle
|
7
8
|
# @return [false,true] is bold?
|
8
9
|
attr_accessor :bold
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OoxmlParser
|
2
4
|
# Class for parsing `hlinkClick`, `hyperlink` tags
|
3
5
|
class Hyperlink < OOXMLDocumentObject
|
@@ -33,7 +35,7 @@ module OoxmlParser
|
|
33
35
|
@url = Coordinates.parse_coordinates_from_string(value.value)
|
34
36
|
when 'id'
|
35
37
|
@id = value.value
|
36
|
-
@url = OOXMLDocumentObject.get_link_from_rels(@id)
|
38
|
+
@url = OOXMLDocumentObject.get_link_from_rels(@id) unless @id.empty?
|
37
39
|
when 'tooltip'
|
38
40
|
@tooltip = value.value
|
39
41
|
when 'ref'
|
@@ -65,7 +67,7 @@ module OoxmlParser
|
|
65
67
|
@action = :slide
|
66
68
|
@url = OOXMLDocumentObject.get_link_from_rels(@id).scan(/\d+/).join('').to_i
|
67
69
|
else
|
68
|
-
|
70
|
+
if @id && !@id.empty?
|
69
71
|
@action = :external_link
|
70
72
|
@url = OOXMLDocumentObject.get_link_from_rels(@id)
|
71
73
|
end
|
@@ -1,12 +1,17 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'filemagic' unless Gem.win_platform?
|
2
4
|
require 'securerandom'
|
3
5
|
require 'nokogiri'
|
4
6
|
require 'zip'
|
5
7
|
require_relative 'ooxml_document_object/ooxml_document_object_helper'
|
8
|
+
require_relative 'ooxml_document_object/ooxml_object_attribute_helper'
|
6
9
|
|
7
10
|
module OoxmlParser
|
11
|
+
# Basic class for any OOXML Document Object
|
8
12
|
class OOXMLDocumentObject
|
9
13
|
include OoxmlDocumentObjectHelper
|
14
|
+
include OoxmlObjectAttributeHelper
|
10
15
|
# @return [OOXMLDocumentObject] object which hold current object
|
11
16
|
attr_accessor :parent
|
12
17
|
|
@@ -14,7 +19,12 @@ module OoxmlParser
|
|
14
19
|
@parent = parent
|
15
20
|
end
|
16
21
|
|
22
|
+
# Compare this object to other
|
23
|
+
# @param other [Object] any other object
|
24
|
+
# @return [True, False] result of comparision
|
17
25
|
def ==(other)
|
26
|
+
return false if self.class != other.class
|
27
|
+
|
18
28
|
instance_variables.each do |current_attribute|
|
19
29
|
next if current_attribute == :@parent
|
20
30
|
return false unless instance_variable_get(current_attribute) == other.instance_variable_get(current_attribute)
|
@@ -27,6 +37,11 @@ module OoxmlParser
|
|
27
37
|
true
|
28
38
|
end
|
29
39
|
|
40
|
+
# @return [Nokogiri::XML::Document] result of parsing xml via nokogiri
|
41
|
+
def parse_xml(xml_path)
|
42
|
+
Nokogiri::XML(File.open(xml_path), &:strict)
|
43
|
+
end
|
44
|
+
|
30
45
|
class << self
|
31
46
|
attr_accessor :root_subfolder
|
32
47
|
attr_accessor :theme
|
@@ -34,8 +49,14 @@ module OoxmlParser
|
|
34
49
|
attr_accessor :path_to_folder
|
35
50
|
|
36
51
|
# @param path_to_file [String] file
|
52
|
+
# @param ignore_system [True, False] should host system be ignored, since
|
53
|
+
# this method is OS-dependent
|
37
54
|
# @return [True, False] Check if file is protected by password on open
|
38
|
-
def encrypted_file?(path_to_file)
|
55
|
+
def encrypted_file?(path_to_file, ignore_system: false)
|
56
|
+
if Gem.win_platform? || ignore_system
|
57
|
+
warn 'FileMagic and checking file for encryption is not supported on Windows'
|
58
|
+
return false
|
59
|
+
end
|
39
60
|
file_result = FileMagic.new(:mime).file(path_to_file)
|
40
61
|
# Support of Encrtypted status in `file` util was introduced in file v5.20
|
41
62
|
# but LTS version of ubuntu before 16.04 uses older `file` and it return `Composite Document`
|
@@ -49,6 +70,9 @@ module OoxmlParser
|
|
49
70
|
false
|
50
71
|
end
|
51
72
|
|
73
|
+
# Copy this file and rename to zip
|
74
|
+
# @param path [String] path to file
|
75
|
+
# @return [String] path to result zip
|
52
76
|
def copy_file_and_rename_to_zip(path)
|
53
77
|
file_name = File.basename(path)
|
54
78
|
tmp_folder = Dir.mktmpdir('ruby-ooxml-parser')
|
@@ -56,14 +80,20 @@ module OoxmlParser
|
|
56
80
|
FileUtils.rm_rf(tmp_folder) if File.directory?(tmp_folder)
|
57
81
|
FileUtils.mkdir_p(tmp_folder)
|
58
82
|
raise "Cannot find file by path #{path}" unless File.exist?(path)
|
83
|
+
|
59
84
|
FileUtils.cp path, tmp_folder
|
60
85
|
file_path
|
61
86
|
end
|
62
87
|
|
88
|
+
# Unzip specified file
|
89
|
+
# @param path_to_file [String] path to zip file
|
90
|
+
# @param destination [String] folder to extract
|
91
|
+
# @return [void]
|
63
92
|
def unzip_file(path_to_file, destination)
|
64
93
|
Zip.warn_invalid_date = false
|
65
94
|
Zip::File.open(path_to_file) do |zip_file|
|
66
95
|
raise LoadError, "There is no files in zip #{path_to_file}" if zip_file.entries.empty?
|
96
|
+
|
67
97
|
zip_file.each do |file|
|
68
98
|
file_path = File.join(destination, file.name)
|
69
99
|
FileUtils.mkdir_p(File.dirname(file_path))
|
@@ -72,14 +102,19 @@ module OoxmlParser
|
|
72
102
|
end
|
73
103
|
end
|
74
104
|
|
105
|
+
# @return [String] dir to base of file
|
75
106
|
def dir
|
76
107
|
OOXMLDocumentObject.path_to_folder + File.dirname(OOXMLDocumentObject.xmls_stack.last) + '/'
|
77
108
|
end
|
78
109
|
|
110
|
+
# @return [String] path to current xml file
|
79
111
|
def current_xml
|
80
112
|
OOXMLDocumentObject.path_to_folder + OOXMLDocumentObject.xmls_stack.last
|
81
113
|
end
|
82
114
|
|
115
|
+
# Add file to parsing stack
|
116
|
+
# @param path [String] path of file to add to stack
|
117
|
+
# @return [void]
|
83
118
|
def add_to_xmls_stack(path)
|
84
119
|
OOXMLDocumentObject.xmls_stack << if path.include?('..')
|
85
120
|
"#{File.dirname(OOXMLDocumentObject.xmls_stack.last)}/#{path}"
|
@@ -90,10 +125,14 @@ module OoxmlParser
|
|
90
125
|
end
|
91
126
|
end
|
92
127
|
|
128
|
+
# Get link to file from rels file
|
129
|
+
# @param id [String] file to get
|
130
|
+
# @return [String] result
|
93
131
|
def get_link_from_rels(id)
|
94
132
|
rels_path = dir + "_rels/#{File.basename(OOXMLDocumentObject.xmls_stack.last)}.rels"
|
95
133
|
raise LoadError, "Cannot find .rels file by path: #{rels_path}" unless File.exist?(rels_path)
|
96
|
-
|
134
|
+
|
135
|
+
relationships = Relationships.new.parse_file(rels_path)
|
97
136
|
relationships.target_by_id(id)
|
98
137
|
end
|
99
138
|
end
|
@@ -1,126 +1,117 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Module for helper methods for OOXMLDocumentObject
|
5
|
+
module OoxmlDocumentObjectHelper
|
6
|
+
# Convert object to hash
|
7
|
+
# @return [Hash]
|
8
|
+
def to_hash
|
9
|
+
result_hash = {}
|
10
|
+
instance_variables.each do |current_attribute|
|
11
|
+
next if current_attribute == :@parent
|
12
|
+
|
13
|
+
attribute_value = instance_variable_get(current_attribute)
|
14
|
+
next unless attribute_value
|
15
|
+
|
16
|
+
if attribute_value.is_a?(Array)
|
17
|
+
attribute_value.each_with_index do |object_element, index|
|
18
|
+
result_hash["#{current_attribute}_#{index}".to_sym] = object_element.to_hash
|
19
|
+
end
|
20
|
+
else
|
21
|
+
result_hash[current_attribute.to_sym] = if attribute_value.respond_to?(:to_hash)
|
22
|
+
attribute_value.to_hash
|
23
|
+
else
|
24
|
+
attribute_value.to_s
|
25
|
+
end
|
14
26
|
end
|
15
|
-
else
|
16
|
-
result_hash[current_attribute.to_sym] = if attribute_value.respond_to?(:to_hash)
|
17
|
-
attribute_value.to_hash
|
18
|
-
else
|
19
|
-
attribute_value.to_s
|
20
|
-
end
|
21
27
|
end
|
28
|
+
result_hash
|
22
29
|
end
|
23
|
-
result_hash
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
30
|
|
28
|
-
|
29
|
-
ctr: :center,
|
30
|
-
r: :right,
|
31
|
-
just: :justify,
|
32
|
-
b: :bottom,
|
33
|
-
t: :top,
|
34
|
-
tr: :top_right,
|
35
|
-
tl: :top_left,
|
36
|
-
br: :bottom_right,
|
37
|
-
bl: :bottom_left,
|
38
|
-
contentLocked: :content_locked,
|
39
|
-
dist: :distributed,
|
40
|
-
tb: :horizontal,
|
41
|
-
rl: :rotate_on_90,
|
42
|
-
lr: :rotate_on_270,
|
43
|
-
inset: :in,
|
44
|
-
lu: :left_up,
|
45
|
-
ru: :right_up,
|
46
|
-
ld: :left_down,
|
47
|
-
rd: :right_down,
|
48
|
-
d: :down,
|
49
|
-
u: :up,
|
50
|
-
lg: :large,
|
51
|
-
med: :medium,
|
52
|
-
sm: :small,
|
53
|
-
beneathText: :beneath_text,
|
54
|
-
pageBottom: :page_bottom,
|
55
|
-
sectEnd: :section_end,
|
56
|
-
docEnd: :document_end,
|
57
|
-
eachSect: :each_section,
|
58
|
-
eachPage: :each_page,
|
59
|
-
sngStrike: :single,
|
60
|
-
dblStrike: :double,
|
61
|
-
noStrike: :none,
|
62
|
-
lgDash: :large_dash,
|
63
|
-
dashDot: :dash_dot,
|
64
|
-
dashDotDot: :dash_dot_dot,
|
65
|
-
mediumDashed: :medium_dashed,
|
66
|
-
mediumDashDot: :medium_dash_dot,
|
67
|
-
mediumDashDotDot: :medium_dash_dot_dot,
|
68
|
-
lgDashDot: :large_dash_dot,
|
69
|
-
lgDashDotDot: :large_dash_dot_dot,
|
70
|
-
sdtLocked: :sdt_locked,
|
71
|
-
sdtContentLocked: :sdt_content_locked,
|
72
|
-
sysDash: :system_dash,
|
73
|
-
sysDot: :system_dot,
|
74
|
-
sysDashDot: :system_dash_dot,
|
75
|
-
sysDashDotDot: :system_dash_dot_dot,
|
76
|
-
rightMargin: :right_margin,
|
77
|
-
leftMargin: :left_margin,
|
78
|
-
bottomMargin: :bottom_margin,
|
79
|
-
topMargin: :top_margin,
|
80
|
-
undOvr: :under_over,
|
81
|
-
subSup: :subscript_superscript,
|
82
|
-
lrTb: :left_to_right_top_to_bottom,
|
83
|
-
tbRl: :top_to_bottom_right_to_left,
|
84
|
-
btLr: :bottom_to_top_left_to_right,
|
85
|
-
singlelevel: :single_level,
|
86
|
-
maxMin: :max_min,
|
87
|
-
middleDot: :middle_dot,
|
88
|
-
minMax: :min_max,
|
89
|
-
multilevel: :multi_level,
|
90
|
-
nextTo: :next_to,
|
91
|
-
hybridMultilevel: :hybrid_multi_level,
|
92
|
-
rnd: :round,
|
93
|
-
sq: :square }.freeze
|
31
|
+
private
|
94
32
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
33
|
+
VALUE_TO_SYMBOL_HASH = { l: :left,
|
34
|
+
ctr: :center,
|
35
|
+
r: :right,
|
36
|
+
just: :justify,
|
37
|
+
b: :bottom,
|
38
|
+
t: :top,
|
39
|
+
tr: :top_right,
|
40
|
+
tl: :top_left,
|
41
|
+
br: :bottom_right,
|
42
|
+
bl: :bottom_left,
|
43
|
+
contentLocked: :content_locked,
|
44
|
+
dist: :distributed,
|
45
|
+
tb: :horizontal,
|
46
|
+
rl: :rotate_on_90,
|
47
|
+
lr: :rotate_on_270,
|
48
|
+
inset: :in,
|
49
|
+
lu: :left_up,
|
50
|
+
ru: :right_up,
|
51
|
+
ld: :left_down,
|
52
|
+
rd: :right_down,
|
53
|
+
d: :down,
|
54
|
+
u: :up,
|
55
|
+
lg: :large,
|
56
|
+
med: :medium,
|
57
|
+
sm: :small,
|
58
|
+
beneathText: :beneath_text,
|
59
|
+
greaterThan: :greater_than,
|
60
|
+
pageBottom: :page_bottom,
|
61
|
+
sectEnd: :section_end,
|
62
|
+
docEnd: :document_end,
|
63
|
+
eachSect: :each_section,
|
64
|
+
eachPage: :each_page,
|
65
|
+
sngStrike: :single,
|
66
|
+
dblStrike: :double,
|
67
|
+
noStrike: :none,
|
68
|
+
lgDash: :large_dash,
|
69
|
+
dashDot: :dash_dot,
|
70
|
+
dashDotDot: :dash_dot_dot,
|
71
|
+
mediumDashed: :medium_dashed,
|
72
|
+
mediumDashDot: :medium_dash_dot,
|
73
|
+
mediumDashDotDot: :medium_dash_dot_dot,
|
74
|
+
lgDashDot: :large_dash_dot,
|
75
|
+
lgDashDotDot: :large_dash_dot_dot,
|
76
|
+
sdtLocked: :sdt_locked,
|
77
|
+
sdtContentLocked: :sdt_content_locked,
|
78
|
+
sysDash: :system_dash,
|
79
|
+
sysDot: :system_dot,
|
80
|
+
sysDashDot: :system_dash_dot,
|
81
|
+
sysDashDotDot: :system_dash_dot_dot,
|
82
|
+
rightMargin: :right_margin,
|
83
|
+
leftMargin: :left_margin,
|
84
|
+
bottomMargin: :bottom_margin,
|
85
|
+
topMargin: :top_margin,
|
86
|
+
undOvr: :under_over,
|
87
|
+
subSup: :subscript_superscript,
|
88
|
+
lrTb: :left_to_right_top_to_bottom,
|
89
|
+
tbRl: :top_to_bottom_right_to_left,
|
90
|
+
btLr: :bottom_to_top_left_to_right,
|
91
|
+
singlelevel: :single_level,
|
92
|
+
maxMin: :max_min,
|
93
|
+
middleDot: :middle_dot,
|
94
|
+
minMax: :min_max,
|
95
|
+
multilevel: :multi_level,
|
96
|
+
nextTo: :next_to,
|
97
|
+
hybridMultilevel: :hybrid_multi_level,
|
98
|
+
rnd: :round,
|
99
|
+
sq: :square }.freeze
|
103
100
|
|
104
|
-
|
105
|
-
|
106
|
-
return
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
!(status == 'false' || status == 'off' || status == '0')
|
111
|
-
end
|
101
|
+
# Convert value to human readable symbol
|
102
|
+
# @param [String] value to convert
|
103
|
+
# @return [Symbol]
|
104
|
+
def value_to_symbol(value)
|
105
|
+
symbol = VALUE_TO_SYMBOL_HASH[value.value.to_sym]
|
106
|
+
return value.value.to_sym if symbol.nil?
|
112
107
|
|
113
|
-
|
114
|
-
|
115
|
-
return false if node.to_s == '0'
|
116
|
-
return false if node.attribute(attribute_name).nil?
|
117
|
-
status = node.attribute(attribute_name).value
|
118
|
-
status == 'true' || status == 'on' || status == '1'
|
119
|
-
end
|
108
|
+
symbol
|
109
|
+
end
|
120
110
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
111
|
+
def root_object
|
112
|
+
tree_object = self
|
113
|
+
tree_object = tree_object.parent until tree_object.parent.nil?
|
114
|
+
tree_object
|
115
|
+
end
|
125
116
|
end
|
126
117
|
end
|