ooxml_parser 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -5
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/chart_style.rb +19 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +18 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +19 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +20 -14
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/order.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_index.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point/text_value.rb +15 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point_count.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +39 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/view_3d.rb +32 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +81 -74
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +20 -13
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +15 -14
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +15 -12
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +15 -10
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +22 -11
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing/doc_properties.rb +24 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +34 -20
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +9 -10
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +18 -25
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +4 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +23 -20
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +15 -5
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +104 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb +17 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_horizontal.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_vertical.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +17 -16
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +12 -15
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +15 -10
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb +38 -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 +21 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +27 -10
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties/preset_text_warp.rb +7 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +20 -11
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +18 -15
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +11 -9
- 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 +39 -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.rb +15 -27
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +13 -9
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +20 -23
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +27 -22
- 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 +19 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip.rb +21 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill.rb +24 -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 +24 -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 +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry.rb +24 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +3 -3
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +22 -13
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +20 -12
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +9 -8
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +15 -13
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +14 -12
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +15 -12
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +18 -14
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +12 -11
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +20 -24
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/color.rb +48 -182
- data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +15 -10
- data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +1 -63
- data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +17 -20
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop/preset_color.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +20 -7
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +12 -11
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +17 -17
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +15 -9
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +19 -16
- data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +10 -6
- data/lib/ooxml_parser/common_parser/common_data/font_style.rb +1 -61
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +33 -26
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +97 -0
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +23 -37
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +71 -23
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/language.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +11 -7
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +92 -40
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +12 -8
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +37 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +53 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +36 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +6 -6
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tab_list/presentation_tab.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tab_list.rb +36 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/paragraph_tab.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +36 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb +11 -8
- data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +20 -12
- data/lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb +13 -7
- data/lib/ooxml_parser/common_parser/common_data/relationships.rb +36 -4
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +12 -8
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +18 -19
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +9 -8
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_layout.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +17 -14
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +16 -23
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +21 -40
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +50 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_row_band_size.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +28 -23
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties/vertical_merge.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +71 -69
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb +18 -10
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +19 -17
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +31 -48
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line/line_join.rb +21 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +25 -19
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties/table_row_height.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +20 -10
- data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +20 -16
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid/grid_column.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +27 -3
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties/table_borders.rb +20 -13
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +54 -37
- data/lib/ooxml_parser/common_parser/common_data/table.rb +23 -17
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +13 -10
- data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +29 -0
- data/lib/ooxml_parser/common_parser/parser.rb +32 -4
- data/lib/ooxml_parser/configuration.rb +3 -13
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +16 -16
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +18 -13
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb +18 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb +37 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +43 -14
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark.rb +21 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +19 -5
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties/argument_size.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties.rb +21 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +24 -4
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +14 -5
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +27 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +15 -5
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +14 -5
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +23 -7
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +16 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +20 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +25 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb +25 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +4 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +36 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_grow.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_limit_location.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties.rb +26 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary.rb +31 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +19 -5
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +52 -183
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +89 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb +23 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object.rb +21 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +24 -17
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +7 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +15 -10
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +43 -245
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +19 -20
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +24 -65
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb +41 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +31 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +146 -172
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +45 -26
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/multilevel_type.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_justification.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_text.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/numbering_format.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/start.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +31 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +65 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +42 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition/abstract_numbering_id.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition.rb +31 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +45 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +15 -4
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +24 -13
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +6 -12
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/footnote_properties.rb +32 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +8 -9
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +31 -24
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +61 -64
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +56 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/paragraph_properties_default.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/run_properties_default.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb +26 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +19 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +49 -54
- data/lib/ooxml_parser/docx_parser/docx_parser.rb +2 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_helpers.rb +13 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +15 -12
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties/stretch.rb +11 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties.rb +21 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +19 -6
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +27 -16
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +13 -9
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +11 -8
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +19 -15
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +17 -12
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +15 -14
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +18 -15
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +9 -11
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition.rb +16 -13
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +23 -15
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +21 -19
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +15 -11
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +52 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +13 -7
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb +11 -9
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +13 -15
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +9 -14
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +30 -67
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +11 -8
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +6 -3
- 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 +28 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +25 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +38 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +35 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +38 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats/number_format.rb +24 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +47 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +36 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb +11 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +11 -10
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +8 -10
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb +12 -12
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +12 -10
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +29 -8
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb +24 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +21 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +30 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +29 -10
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb +25 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +23 -29
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb +15 -12
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style.rb +70 -37
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +16 -12
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +31 -9
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +34 -12
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +20 -9
- data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +1 -1
- data/lib/ooxml_parser.rb +0 -1
- metadata +122 -58
- data/lib/ooxml_parser/common_parser/common_data/alingment.rb +0 -56
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_style/office_2007_chart_style.rb +0 -17
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_style/office_2010_chart_style.rb +0 -17
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/group/docx_group_element.rb +0 -10
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/group/docx_grouped_drawing.rb +0 -34
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_gradient_color.rb +0 -30
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_single_gradient_color.rb +0 -6
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/solid_color/docx_solid_color.rb +0 -10
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_element.rb +0 -10
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end/line_size.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_style/docx_shape_style.rb +0 -5
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/common_non_visual_properties.rb +0 -25
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/non_visual_properties.rb +0 -19
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/non_visual_shape_properties.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape.rb +0 -28
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_placeholder.rb +0 -18
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/ooxml_shift.rb +0 -15
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/transform_effect.rb +0 -28
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties.rb +0 -13
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/ooxml_text_box.rb +0 -26
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/text_body.rb +0 -23
- data/lib/ooxml_parser/common_parser/common_data/colors/image/stretching/fill_rectangle.rb +0 -22
- data/lib/ooxml_parser/common_parser/common_data/colors/image/stretching.rb +0 -12
- data/lib/ooxml_parser/common_parser/common_data/colors/image_properties.rb +0 -16
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/strikeout.rb +0 -16
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering/numbering_properties/numbering_level.rb +0 -25
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering/numbering_properties.rb +0 -69
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering.rb +0 -18
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_cell_margin.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_elements.rb +0 -21
- data/lib/ooxml_parser/common_parser/common_data/table/properties/whole_table/line_join.rb +0 -19
- data/lib/ooxml_parser/common_parser/common_data/table/properties/whole_table/table_cell_style.rb +0 -20
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/operator.rb +0 -13
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/bookmark.rb +0 -10
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/paragraph_tab.rb +0 -19
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb +0 -35
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb +0 -56
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/image.rb +0 -15
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/size.rb +0 -84
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping/grouping_properties.rb +0 -16
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character/excel_comment_character_properties.rb +0 -27
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character.rb +0 -25
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position/xlsx_drawing_position_parameters.rb +0 -22
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position.rb +0 -22
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb +0 -37
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/foreground_color.rb +0 -25
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/ooxml_font.rb +0 -36
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_table.rb +0 -30
@@ -1,22 +1,32 @@
|
|
1
|
+
require_relative 'table_row_properties/table_row_height'
|
1
2
|
module OoxmlParser
|
2
3
|
# Class for describing Table Row Properties
|
3
4
|
class TableRowProperties < OOXMLDocumentObject
|
4
|
-
# @return [
|
5
|
+
# @return [TableRowHeight] Table Row Height
|
5
6
|
attr_accessor :height
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
# @return [OoxmlSize] Table cell spacing
|
8
|
+
attr_accessor :cells_spacing
|
9
|
+
# @return [True, False]
|
10
|
+
# Specifies that the current row should
|
11
|
+
# be repeated at the top each new page on which the table is displayed.
|
12
|
+
# >ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference 17.4.50
|
13
|
+
attr_accessor :table_header
|
10
14
|
|
11
15
|
# Parse Columns data
|
12
16
|
# @param [Nokogiri::XML:Element] node with Table Row Properties data
|
13
17
|
# @return [TableRowProperties] value of Columns data
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
def parse(node)
|
19
|
+
node.xpath('*').each do |node_child|
|
20
|
+
case node_child.name
|
21
|
+
when 'trHeight'
|
22
|
+
@height = TableRowHeight.new(parent: self).parse(node_child)
|
23
|
+
when 'tblCellSpacing'
|
24
|
+
@cells_spacing = OoxmlSize.new.parse(node_child)
|
25
|
+
when 'tblHeader'
|
26
|
+
@table_header = option_enabled?(node_child)
|
27
|
+
end
|
18
28
|
end
|
19
|
-
|
29
|
+
self
|
20
30
|
end
|
21
31
|
end
|
22
32
|
end
|
@@ -2,32 +2,36 @@ require_relative 'cell/cell'
|
|
2
2
|
require_relative 'row/table_row_properties'
|
3
3
|
module OoxmlParser
|
4
4
|
class TableRow < OOXMLDocumentObject
|
5
|
-
attr_accessor :height, :cells, :
|
5
|
+
attr_accessor :height, :cells, :table_row_properties
|
6
6
|
|
7
|
-
def initialize(cells = [])
|
7
|
+
def initialize(cells = [], parent: nil)
|
8
8
|
@cells = cells
|
9
|
+
@parent = parent
|
9
10
|
end
|
10
11
|
|
11
12
|
alias table_row_height height
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
# Parse TableRow object
|
15
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
16
|
+
# @return [TableRow] result of parsing
|
17
|
+
def parse(node)
|
18
|
+
Presentation.current_font_style = FontStyle.new(true) # TODO: Add correct parsing of TableStyle.xml file and use it
|
19
|
+
node.attributes.each do |key, value|
|
20
|
+
case key
|
21
|
+
when 'h'
|
22
|
+
@height = OoxmlSize.new(value.value.to_f, :emu)
|
23
|
+
end
|
18
24
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
node.xpath('*').each do |node_child|
|
26
|
+
case node_child.name
|
27
|
+
when 'trPr'
|
28
|
+
@table_row_properties = TableRowProperties.new(parent: self).parse(node_child)
|
29
|
+
when 'tc'
|
30
|
+
@cells << TableCell.new(parent: self).parse(node_child)
|
25
31
|
end
|
26
32
|
end
|
27
|
-
Presentation.current_font_style = FontStyle.new(true) # TODO: Add correct parsing of TableStyle.xml file and use it
|
28
|
-
row_node.xpath("#{OOXMLDocumentObject.namespace_prefix}:tc").each { |cell_node| row.cells << TableCell.parse(cell_node) }
|
29
33
|
Presentation.current_font_style = FontStyle.new
|
30
|
-
|
34
|
+
self
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
# Class for parsing `w:gridCol` object
|
3
|
+
class GridColumn < OOXMLDocumentObject
|
4
|
+
# @return [Float] width of column
|
5
|
+
attr_accessor :width
|
6
|
+
|
7
|
+
# Parse GridColumn
|
8
|
+
# @param [Nokogiri::XML:Node] node with GridColumn
|
9
|
+
# @return [GridColumn] result of parsing
|
10
|
+
def parse(node)
|
11
|
+
node.attributes.each do |key, value|
|
12
|
+
case key
|
13
|
+
when 'w'
|
14
|
+
@width = OoxmlSize.new(value.value.to_f)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,9 +1,33 @@
|
|
1
|
+
require_relative 'table_grid/grid_column'
|
1
2
|
module OoxmlParser
|
3
|
+
# Class for parsing `w:tblGrid` object
|
2
4
|
class TableGrid < OOXMLDocumentObject
|
3
|
-
|
5
|
+
# @return [Array, GridColumn] array of columns
|
6
|
+
attr_accessor :columns
|
4
7
|
|
5
|
-
def initialize(
|
6
|
-
@columns =
|
8
|
+
def initialize(parent: nil)
|
9
|
+
@columns = []
|
10
|
+
@parent = parent
|
11
|
+
end
|
12
|
+
|
13
|
+
def ==(other)
|
14
|
+
@columns.each_with_index do |cur_column, index|
|
15
|
+
return false unless cur_column == other.columns[index]
|
16
|
+
end
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
# Parse TableGrid
|
21
|
+
# @param [Nokogiri::XML:Node] node with TableGrid
|
22
|
+
# @return [TableGrid] result of parsing
|
23
|
+
def parse(node)
|
24
|
+
node.xpath('*').each do |grid_child|
|
25
|
+
case grid_child.name
|
26
|
+
when 'gridCol'
|
27
|
+
@columns << GridColumn.new(parent: self).parse(grid_child)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
self
|
7
31
|
end
|
8
32
|
end
|
9
33
|
end
|
@@ -1,33 +1,40 @@
|
|
1
1
|
module OoxmlParser
|
2
2
|
# Class for describing Table Border Propertie
|
3
3
|
class TableBorders < OOXMLDocumentObject
|
4
|
-
# @return [BordersProperties] left border
|
4
|
+
# @return [BordersProperties] left border property
|
5
5
|
attr_accessor :left
|
6
|
-
# @return [BordersProperties] right border
|
6
|
+
# @return [BordersProperties] right border property
|
7
7
|
attr_accessor :right
|
8
|
-
# @return [BordersProperties] top border
|
8
|
+
# @return [BordersProperties] top border property
|
9
9
|
attr_accessor :top
|
10
|
-
# @return [BordersProperties] bottom border
|
10
|
+
# @return [BordersProperties] bottom border property
|
11
11
|
attr_accessor :bottom
|
12
|
+
# @return [BordersProperties] inside vertical property
|
13
|
+
attr_accessor :inside_vertical
|
14
|
+
# @return [BordersProperties] inside horizontal property
|
15
|
+
attr_accessor :inside_horizontal
|
12
16
|
|
13
17
|
# Parse Table Borders data
|
14
18
|
# @param [Nokogiri::XML:Element] node with Table Borders data
|
15
19
|
# @return [TableBorders] value of Table Borders data
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
case cell_borders_node.name
|
20
|
+
def parse(node)
|
21
|
+
node.xpath('*').each do |node_child|
|
22
|
+
case node_child.name
|
20
23
|
when 'left'
|
21
|
-
|
24
|
+
@left = BordersProperties.new(parent: self).parse(node_child)
|
22
25
|
when 'top'
|
23
|
-
|
26
|
+
@top = BordersProperties.new(parent: self).parse(node_child)
|
24
27
|
when 'right'
|
25
|
-
|
28
|
+
@right = BordersProperties.new(parent: self).parse(node_child)
|
26
29
|
when 'bottom'
|
27
|
-
|
30
|
+
@bottom = BordersProperties.new(parent: self).parse(node_child)
|
31
|
+
when 'insideV'
|
32
|
+
@inside_vertical = BordersProperties.new(parent: self).parse(node_child)
|
33
|
+
when 'insideH'
|
34
|
+
@inside_horizontal = BordersProperties.new(parent: self).parse(node_child)
|
28
35
|
end
|
29
36
|
end
|
30
|
-
|
37
|
+
self
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|
@@ -1,80 +1,97 @@
|
|
1
1
|
# Table Properties Data
|
2
|
-
require_relative 'properties/
|
2
|
+
require_relative 'properties/table_layout'
|
3
3
|
require_relative 'properties/table_look'
|
4
4
|
require_relative 'properties/table_style'
|
5
|
+
require_relative 'properties/table_style_column_band_size'
|
6
|
+
require_relative 'properties/table_style_row_band_size'
|
5
7
|
require_relative 'properties/table_position'
|
8
|
+
require_relative 'properties/table_style_properties'
|
6
9
|
require_relative 'table_properties/table_borders'
|
7
10
|
module OoxmlParser
|
11
|
+
# Class for parsing `w:tblPr` tags
|
8
12
|
class TableProperties < OOXMLDocumentObject
|
9
|
-
attr_accessor :jc, :table_width, :
|
10
|
-
:column_banding_size, :table_look, :grid_column, :
|
13
|
+
attr_accessor :jc, :table_width, :table_borders, :table_properties, :table_positon, :table_cell_margin, :table_indent, :stretching, :table_style, :row_banding_size,
|
14
|
+
:column_banding_size, :table_look, :grid_column, :style
|
15
|
+
# @return [TableStyleColumnBandSize] table style column band size
|
16
|
+
attr_accessor :table_style_column_band_size
|
17
|
+
# @return [TableStyleRowBandSize] table style row band size
|
18
|
+
attr_accessor :table_style_row_band_size
|
19
|
+
# @return [TableLayout] table layout
|
20
|
+
attr_accessor :table_layout
|
21
|
+
# @return [OoxmlSize] table cell spacing
|
22
|
+
attr_accessor :table_cell_spacing
|
23
|
+
# @return [Shade] shade color of table
|
24
|
+
attr_accessor :shade
|
25
|
+
# @return [ValuedChild] caption of table
|
26
|
+
attr_accessor :caption
|
27
|
+
# @return [ValuedChild] description of table
|
28
|
+
attr_accessor :description
|
11
29
|
|
12
30
|
alias table_properties table_positon
|
13
31
|
|
14
|
-
def initialize
|
15
|
-
@table_indent = nil
|
16
|
-
@table_cell_margin = nil
|
32
|
+
def initialize(parent: nil)
|
17
33
|
@jc = :left
|
18
|
-
@shd = nil
|
19
|
-
@stretching = true
|
20
34
|
@table_borders = TableBorders.new
|
21
|
-
@
|
22
|
-
@table_width = nil
|
23
|
-
@grid_column = nil
|
24
|
-
@right_to_left = nil
|
25
|
-
@style = nil
|
35
|
+
@parent = parent
|
26
36
|
end
|
27
37
|
|
28
38
|
def copy
|
29
39
|
table = TableProperties.new
|
30
40
|
table.jc = @jc
|
31
41
|
table.table_width = @table_width
|
32
|
-
table.
|
42
|
+
table.shade = @shade
|
33
43
|
table.stretching = @stretching
|
34
44
|
table.table_borders = @table_borders
|
35
45
|
table.table_properties = @table_properties
|
36
46
|
table.table_cell_margin = @table_cell_margin
|
37
47
|
table.table_indent = @table_indent
|
38
48
|
table.grid_column = @grid_column
|
39
|
-
table.right_to_left = @right_to_left
|
40
49
|
table.style = style
|
41
50
|
table
|
42
51
|
end
|
43
52
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
53
|
+
# Parse TableProperties object
|
54
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
55
|
+
# @return [TableProperties] result of parsing
|
56
|
+
def parse(node)
|
57
|
+
node.xpath('*').each do |node_child|
|
58
|
+
case node_child.name
|
48
59
|
when 'tableStyleId'
|
49
|
-
|
60
|
+
@style = TableStyle.new(parent: self).parse(style_id: node_child.text)
|
50
61
|
when 'tblBorders'
|
51
|
-
|
62
|
+
@table_borders = TableBorders.new(parent: self).parse(node_child)
|
52
63
|
when 'tblStyle'
|
53
|
-
|
54
|
-
next if style.nil?
|
55
|
-
table_properties.table_style = TableStyle.parse(table_style_node: style)
|
64
|
+
@table_style = root_object.document_style_by_id(node_child.attribute('val').value)
|
56
65
|
when 'tblW'
|
57
|
-
|
66
|
+
@table_width = OoxmlSize.new.parse(node_child)
|
58
67
|
when 'jc'
|
59
|
-
|
68
|
+
@jc = node_child.attribute('val').text.to_sym
|
60
69
|
when 'shd'
|
61
|
-
|
62
|
-
background_color = Color.from_int16(table_props_node_child.attribute('fill').value)
|
63
|
-
table_properties.shd = background_color
|
64
|
-
end
|
70
|
+
@shade = Shade.new(parent: self).parse(node_child)
|
65
71
|
when 'tblLook'
|
66
|
-
|
72
|
+
@table_look = TableLook.new(parent: self).parse(node_child)
|
67
73
|
when 'tblInd'
|
68
|
-
|
74
|
+
@table_indent = OoxmlSize.new(node_child.attribute('w').text.to_f)
|
69
75
|
when 'tblpPr'
|
70
|
-
|
76
|
+
@table_positon = TablePosition.new(parent: self).parse(node_child)
|
71
77
|
when 'tblCellMar'
|
72
|
-
|
78
|
+
@table_cell_margin = TableMargins.new(parent: table_properties).parse(node_child)
|
79
|
+
when 'tblStyleColBandSize'
|
80
|
+
@table_style_column_band_size = TableStyleColumnBandSize.new(parent: self).parse(node_child)
|
81
|
+
when 'tblStyleRowBandSize'
|
82
|
+
@table_style_row_band_size = TableStyleRowBandSize.new(parent: self).parse(node_child)
|
83
|
+
when 'tblLayout'
|
84
|
+
@table_layout = TableLayout.new(parent: self).parse(node_child)
|
85
|
+
when 'tblCellSpacing'
|
86
|
+
@table_cell_spacing = OoxmlSize.new.parse(node_child)
|
87
|
+
when 'tblCaption'
|
88
|
+
@caption = ValuedChild.new(:string, parent: self).parse(node_child)
|
89
|
+
when 'tblDescription'
|
90
|
+
@description = ValuedChild.new(:string, parent: self).parse(node_child)
|
73
91
|
end
|
74
92
|
end
|
75
|
-
|
76
|
-
|
77
|
-
table_properties
|
93
|
+
@table_look = TableLook.new(parent: self).parse(node) if @table_look.nil?
|
94
|
+
self
|
78
95
|
end
|
79
96
|
end
|
80
97
|
end
|
@@ -7,35 +7,41 @@ module OoxmlParser
|
|
7
7
|
class Table < OOXMLDocumentObject
|
8
8
|
attr_accessor :grid, :rows, :properties, :number
|
9
9
|
|
10
|
-
def initialize(rows = [])
|
10
|
+
def initialize(rows = [], parent: nil)
|
11
11
|
@rows = rows
|
12
|
+
@parent = parent
|
12
13
|
end
|
13
14
|
|
14
15
|
alias table_properties properties
|
15
16
|
|
16
|
-
def
|
17
|
+
def to_s
|
18
|
+
"Rows: #{@rows.join(',')}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def inspect
|
22
|
+
to_s
|
23
|
+
end
|
24
|
+
|
25
|
+
# Parse Table object
|
26
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
27
|
+
# @return [Table] result of parsing
|
28
|
+
def parse(node,
|
29
|
+
number = 0,
|
30
|
+
default_table_properties = TableProperties.new)
|
17
31
|
table_properties = default_table_properties.copy
|
18
32
|
table_properties.jc = :left
|
19
|
-
|
20
|
-
|
21
|
-
table = Table.new
|
22
|
-
table_node.xpath('*').each do |table_node_child|
|
23
|
-
case table_node_child.name
|
33
|
+
node.xpath('*').each do |node_child|
|
34
|
+
case node_child.name
|
24
35
|
when 'tblGrid'
|
25
|
-
|
26
|
-
table_node_child.xpath('gridCol').each do |grid_col_node|
|
27
|
-
table.grid.columns << (grid_col_node.attribute('w').value.to_f / 360_000.0).round(2)
|
28
|
-
end
|
36
|
+
@grid = TableGrid.new(parent: self).parse(node_child)
|
29
37
|
when 'tr'
|
30
|
-
|
38
|
+
@rows << TableRow.new(parent: self).parse(node_child)
|
31
39
|
when 'tblPr'
|
32
|
-
|
33
|
-
when ''
|
34
|
-
DocxParagraph.parse_paragraph_style(table_node_child, table_paragraph, table_character)
|
40
|
+
@properties = TableProperties.new(parent: self).parse(node_child)
|
35
41
|
end
|
36
42
|
end
|
37
|
-
|
38
|
-
|
43
|
+
@number = number
|
44
|
+
self
|
39
45
|
end
|
40
46
|
end
|
41
47
|
end
|
@@ -1,11 +1,12 @@
|
|
1
|
-
# Class for working Underline style parameter
|
2
1
|
module OoxmlParser
|
3
|
-
|
2
|
+
# Class for parsing `u` tags
|
3
|
+
class Underline < OOXMLDocumentObject
|
4
4
|
attr_accessor :style, :color
|
5
5
|
|
6
|
-
def initialize(style = :none, color = nil)
|
7
|
-
@style =
|
6
|
+
def initialize(style = :none, color = nil, parent: nil)
|
7
|
+
@style = style == 'single' ? :single : style
|
8
8
|
@color = color
|
9
|
+
@parent = parent
|
9
10
|
end
|
10
11
|
|
11
12
|
def ==(other)
|
@@ -26,15 +27,17 @@ module OoxmlParser
|
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
# Parse Underline object
|
31
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
32
|
+
# @return [Underline] result of parsing
|
33
|
+
def parse(node)
|
34
|
+
case node
|
32
35
|
when 'sng'
|
33
|
-
|
36
|
+
@style = :single
|
34
37
|
when 'none'
|
35
|
-
|
38
|
+
@style = :none
|
36
39
|
end
|
37
|
-
|
40
|
+
self
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
# Class for working with any tag contained only value
|
3
|
+
class ValuedChild < OOXMLDocumentObject
|
4
|
+
# @return [String] value of tag
|
5
|
+
attr_accessor :value
|
6
|
+
# @return [String] type of value
|
7
|
+
attr_reader :type
|
8
|
+
|
9
|
+
def initialize(type = :string, parent: nil)
|
10
|
+
@parent = parent
|
11
|
+
@type = type
|
12
|
+
end
|
13
|
+
|
14
|
+
# Parse ValuedChild object
|
15
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
16
|
+
# @return [ValuedChild] result of parsing
|
17
|
+
def parse(node)
|
18
|
+
node.attributes.each do |key, value|
|
19
|
+
case key
|
20
|
+
when 'val'
|
21
|
+
@value = value.value.to_s if type == :string
|
22
|
+
@value = value_to_symbol(value) if type == :symbol
|
23
|
+
@value = value.value.to_i if type == :integer
|
24
|
+
end
|
25
|
+
end
|
26
|
+
self
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,17 +1,45 @@
|
|
1
1
|
module OoxmlParser
|
2
2
|
class Parser
|
3
|
-
# Base method to parse document of any type
|
3
|
+
# Base method to yield parse document of any type
|
4
4
|
# @param path_to_file [String] file
|
5
5
|
# @return [CommonDocumentStructure] structure of doc
|
6
|
-
def self.
|
6
|
+
def self.parse_format(path_to_file)
|
7
7
|
return nil if OOXMLDocumentObject.encrypted_file?(path_to_file)
|
8
8
|
path_to_zip_file = OOXMLDocumentObject.copy_file_and_rename_to_zip(path_to_file)
|
9
9
|
OOXMLDocumentObject.path_to_folder = path_to_zip_file.sub(File.basename(path_to_zip_file), '')
|
10
10
|
OOXMLDocumentObject.unzip_file(path_to_zip_file, OOXMLDocumentObject.path_to_folder)
|
11
11
|
model = yield
|
12
|
-
model.file_path = path_to_file
|
13
|
-
FileUtils.
|
12
|
+
model.file_path = path_to_file if model
|
13
|
+
FileUtils.rm_rf(OOXMLDocumentObject.path_to_folder)
|
14
14
|
model
|
15
15
|
end
|
16
|
+
|
17
|
+
# Base method to parse document of any type
|
18
|
+
# @param path_to_file [String] file
|
19
|
+
# @return [CommonDocumentStructure] structure of doc
|
20
|
+
def self.parse(path_to_file)
|
21
|
+
Parser.parse_format(path_to_file) do
|
22
|
+
format = Parser.recognize_folder_format
|
23
|
+
case format
|
24
|
+
when :docx
|
25
|
+
DocumentStructure.parse
|
26
|
+
when :xlsx
|
27
|
+
XLSXWorkbook.parse
|
28
|
+
when :pptx
|
29
|
+
Presentation.parse
|
30
|
+
else
|
31
|
+
warn "#{path_to_file} is a simple zip file without OOXML content"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Recognize folder format
|
37
|
+
# @param directory [String] path to dirctory
|
38
|
+
# @return [Symbol] type of document
|
39
|
+
def self.recognize_folder_format(directory = OOXMLDocumentObject.path_to_folder)
|
40
|
+
return :docx if Dir.exist?("#{directory}/word")
|
41
|
+
return :xlsx if Dir.exist?("#{directory}/xl")
|
42
|
+
return :pptx if Dir.exist?("#{directory}/ppt")
|
43
|
+
end
|
16
44
|
end
|
17
45
|
end
|
@@ -1,20 +1,10 @@
|
|
1
1
|
module OoxmlParser
|
2
2
|
class Configuration
|
3
|
-
|
3
|
+
# @return [Integer] accuracy of digits in fraction part
|
4
|
+
attr_accessor :accuracy
|
4
5
|
|
5
6
|
def initialize
|
6
|
-
@
|
7
|
-
end
|
8
|
-
|
9
|
-
# @return [Float] by which divide units values
|
10
|
-
def units_delimiter
|
11
|
-
return (20 * 635.0) if @units == :points
|
12
|
-
return (566.929 * 635.0) if @units == :centimeters
|
13
|
-
return 1 if @units == :dxa
|
14
|
-
return 1440 if @units == :inches
|
15
|
-
return (1.0 / 635.0) if @units == :emu
|
16
|
-
warn "Cannot recognize #{@units} unit. Will use dxa by default"
|
17
|
-
1
|
7
|
+
@accuracy = 2
|
18
8
|
end
|
19
9
|
end
|
20
10
|
end
|
@@ -17,7 +17,7 @@ module OoxmlParser
|
|
17
17
|
document.xpath('w:comment').each do |comment_tag|
|
18
18
|
comment = Comment.new(comment_tag.attribute('id').value)
|
19
19
|
comment_tag.xpath('w:p').each_with_index do |p, index|
|
20
|
-
comment.paragraphs << DocxParagraph.parse(p, index)
|
20
|
+
comment.paragraphs << DocxParagraph.new.parse(p, index)
|
21
21
|
end
|
22
22
|
comments << comment.dup
|
23
23
|
end
|
@@ -1,36 +1,36 @@
|
|
1
1
|
module OoxmlParser
|
2
2
|
# Class for describing Document Background `w:background`
|
3
|
-
class DocumentBackground
|
4
|
-
attr_accessor :color1, :size, :color2, :
|
3
|
+
class DocumentBackground < OOXMLDocumentObject
|
4
|
+
attr_accessor :color1, :size, :color2, :type
|
5
|
+
# @return [FileReference] image structure
|
6
|
+
attr_accessor :file_reference
|
5
7
|
|
6
|
-
def initialize(
|
7
|
-
@color1 =
|
8
|
-
@type =
|
8
|
+
def initialize(parent: nil)
|
9
|
+
@color1 = nil
|
10
|
+
@type = 'simple'
|
11
|
+
@parent = parent
|
9
12
|
end
|
10
13
|
|
11
14
|
# Parse DocumentBackground object
|
12
15
|
# @param node [Nokogiri::XML:Element] node to parse
|
13
16
|
# @return [DocumentBackground] result of parsing
|
14
|
-
def
|
15
|
-
|
16
|
-
background.color1 = Color.from_int16(node.attribute('color').value)
|
17
|
+
def parse(node)
|
18
|
+
@color1 = Color.new(parent: self).parse_hex_string(node.attribute('color').value)
|
17
19
|
node.xpath('v:background').each do |second_color|
|
18
20
|
unless second_color.attribute('targetscreensize').nil?
|
19
|
-
|
21
|
+
@size = second_color.attribute('targetscreensize').value.sub(',', 'x')
|
20
22
|
end
|
21
23
|
second_color.xpath('v:fill').each do |fill|
|
22
24
|
if !fill.attribute('color2').nil?
|
23
|
-
|
24
|
-
|
25
|
+
@color2 = Color.new(parent: self).parse_hex_string(fill.attribute('color2').value.split(' ').first.delete('#'))
|
26
|
+
@type = fill.attribute('type').value
|
25
27
|
elsif !fill.attribute('id').nil?
|
26
|
-
|
27
|
-
|
28
|
-
background.image = path_to_image
|
29
|
-
background.type = 'image'
|
28
|
+
@file_reference = FileReference.new(parent: self).parse(fill)
|
29
|
+
@type = 'image'
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
33
|
+
self
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -1,26 +1,31 @@
|
|
1
|
-
# Document Properties
|
2
1
|
module OoxmlParser
|
2
|
+
# Document Properties
|
3
3
|
class DocumentProperties < OOXMLDocumentObject
|
4
4
|
attr_accessor :pages, :words
|
5
5
|
|
6
|
-
def initialize(pages = nil, words = nil)
|
7
|
-
@pages = pages
|
8
|
-
@words = words
|
9
|
-
end
|
10
|
-
|
11
6
|
# Parse Document properties
|
12
7
|
# @return [DocumentProperties]
|
13
|
-
def
|
14
|
-
properties = DocumentProperties.new
|
8
|
+
def parse
|
15
9
|
properties_file = "#{OOXMLDocumentObject.path_to_folder}docProps/app.xml"
|
16
10
|
unless File.exist?(properties_file)
|
17
11
|
warn "There is no 'docProps/app.xml' in docx. It may be some problem with it"
|
18
|
-
return
|
12
|
+
return self
|
13
|
+
end
|
14
|
+
node = Nokogiri::XML(File.open(properties_file))
|
15
|
+
node.xpath('*').each do |node_child|
|
16
|
+
case node_child.name
|
17
|
+
when 'Properties'
|
18
|
+
node_child.xpath('*').each do |node_child_child|
|
19
|
+
case node_child_child.name
|
20
|
+
when 'Pages'
|
21
|
+
@pages = node_child_child.text.to_i
|
22
|
+
when 'Words'
|
23
|
+
@words = node_child_child.text.to_i
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
19
27
|
end
|
20
|
-
|
21
|
-
properties.pages = doc_props['Pages'].first.to_i unless doc_props['Pages'].nil?
|
22
|
-
properties.words = doc_props['Words'].first.to_i unless doc_props['Words'].nil?
|
23
|
-
properties
|
28
|
+
self
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|