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,18 +1,21 @@
|
|
1
1
|
module OoxmlParser
|
2
|
-
|
2
|
+
# Class for parsing `fld` tags
|
3
|
+
class TextField < OOXMLDocumentObject
|
3
4
|
attr_accessor :id, :type, :text
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# Parse TextField object
|
7
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
8
|
+
# @return [TextField] result of parsing
|
9
|
+
def parse(node)
|
10
|
+
@id = node.attribute('id').value
|
11
|
+
@type = node.attribute('type').value
|
12
|
+
node.xpath('*').each do |text_field_node_child|
|
10
13
|
case text_field_node_child.name
|
11
14
|
when 't'
|
12
|
-
|
15
|
+
@text = text_field_node_child.text
|
13
16
|
end
|
14
17
|
end
|
15
|
-
|
18
|
+
self
|
16
19
|
end
|
17
20
|
end
|
18
21
|
end
|
@@ -2,13 +2,19 @@ require_relative 'paragraph/paragraph_properties'
|
|
2
2
|
require_relative 'paragraph/paragraph_run'
|
3
3
|
require_relative 'paragraph/text_field'
|
4
4
|
module OoxmlParser
|
5
|
-
|
5
|
+
# Class for parsing `p` tags
|
6
|
+
class Paragraph < OOXMLDocumentObject
|
6
7
|
attr_accessor :properties, :runs, :text_field, :formulas
|
8
|
+
# @return [AlternateContent] alternate content data
|
9
|
+
attr_accessor :alternate_content
|
7
10
|
|
8
|
-
def initialize(runs = [],
|
11
|
+
def initialize(runs = [],
|
12
|
+
formulas = [],
|
13
|
+
parent: nil)
|
9
14
|
@runs = runs
|
10
15
|
@formulas = formulas
|
11
16
|
@runs = []
|
17
|
+
@parent = parent
|
12
18
|
end
|
13
19
|
|
14
20
|
alias characters runs
|
@@ -16,21 +22,23 @@ module OoxmlParser
|
|
16
22
|
alias characters= runs=
|
17
23
|
alias character_style_array= runs=
|
18
24
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
25
|
+
# Parse Paragraph object
|
26
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
27
|
+
# @return [Paragraph] result of parsing
|
28
|
+
def parse(node)
|
29
|
+
node.xpath('*').each do |node_child|
|
30
|
+
case node_child.name
|
23
31
|
when 'pPr'
|
24
|
-
|
32
|
+
@properties = ParagraphProperties.new(parent: self).parse(node_child)
|
25
33
|
when 'fld'
|
26
|
-
|
34
|
+
@text_field = TextField.new(parent: self).parse(node_child)
|
27
35
|
when 'r'
|
28
|
-
|
29
|
-
when '
|
30
|
-
|
36
|
+
@runs << ParagraphRun.new(parent: self).parse(node_child)
|
37
|
+
when 'AlternateContent'
|
38
|
+
@alternate_content = AlternateContent.new(parent: self).parse(node_child)
|
31
39
|
end
|
32
40
|
end
|
33
|
-
|
41
|
+
self
|
34
42
|
end
|
35
43
|
end
|
36
44
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module OoxmlParser
|
2
2
|
# Class for single relationship
|
3
|
-
class Relationship
|
3
|
+
class Relationship < OOXMLDocumentObject
|
4
4
|
# @return [String] id of relation
|
5
5
|
attr_accessor :id
|
6
6
|
# @return [String] type of relation
|
@@ -11,12 +11,18 @@ module OoxmlParser
|
|
11
11
|
# Parse Relationship
|
12
12
|
# @param [Nokogiri::XML:Node] node with Relationship
|
13
13
|
# @return [Relationship] result of parsing
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
def parse(node)
|
15
|
+
node.attributes.each do |key, value|
|
16
|
+
case key
|
17
|
+
when 'Id'
|
18
|
+
@id = value.value
|
19
|
+
when 'Type'
|
20
|
+
@type = value.value
|
21
|
+
when 'Target'
|
22
|
+
@target = value.value
|
23
|
+
end
|
24
|
+
end
|
25
|
+
self
|
20
26
|
end
|
21
27
|
end
|
22
28
|
end
|
@@ -17,15 +17,47 @@ module OoxmlParser
|
|
17
17
|
# Parse Relationships
|
18
18
|
# @param [Nokogiri::XML:Node] node with Relationships
|
19
19
|
# @return [Relationships] result of parsing
|
20
|
-
def
|
21
|
-
rels = Relationships.new
|
20
|
+
def parse(node)
|
22
21
|
node.xpath('*').each do |node_children|
|
23
22
|
case node_children.name
|
24
23
|
when 'Relationship'
|
25
|
-
|
24
|
+
@relationship << Relationship.new(parent: self).parse(node_children)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
# Get target name by id
|
31
|
+
# @param id [String] id of target
|
32
|
+
# @return [String] target name
|
33
|
+
def target_by_id(id)
|
34
|
+
@relationship.each do |cur_rels|
|
35
|
+
return cur_rels.target if cur_rels.id == id
|
36
|
+
end
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
# Get target name by type
|
41
|
+
# @param type [String] type of target
|
42
|
+
# @return [String] target name
|
43
|
+
def target_by_type(type)
|
44
|
+
@relationship.each do |cur_rels|
|
45
|
+
return cur_rels.target if cur_rels.type.include?(type)
|
46
|
+
end
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
|
50
|
+
# Parse .rels file
|
51
|
+
# @param file_path [String] path to file
|
52
|
+
# @return [Relationships]
|
53
|
+
def self.parse_rels(file_path)
|
54
|
+
node = Nokogiri::XML(File.open(file_path))
|
55
|
+
node.xpath('*').each do |node_child|
|
56
|
+
case node_child.name
|
57
|
+
when 'Relationships'
|
58
|
+
return Relationships.new.parse(node_child)
|
26
59
|
end
|
27
60
|
end
|
28
|
-
rels
|
29
61
|
end
|
30
62
|
end
|
31
63
|
end
|
@@ -1,10 +1,15 @@
|
|
1
1
|
module OoxmlParser
|
2
2
|
class ParagraphMargins < TableMargins
|
3
|
-
def initialize(top =
|
3
|
+
def initialize(top = OoxmlSize.new(0),
|
4
|
+
bottom = OoxmlSize.new(0),
|
5
|
+
left = OoxmlSize.new(0),
|
6
|
+
right = OoxmlSize.new(0),
|
7
|
+
parent: nil)
|
4
8
|
@top = top
|
5
9
|
@bottom = bottom
|
6
10
|
@left = left
|
7
11
|
@right = right
|
12
|
+
@parent = parent
|
8
13
|
end
|
9
14
|
|
10
15
|
def round(count_of_digits = 1)
|
@@ -15,21 +20,20 @@ module OoxmlParser
|
|
15
20
|
ParagraphMargins.new(top, bottom, left, right)
|
16
21
|
end
|
17
22
|
|
18
|
-
def
|
19
|
-
margins = ParagraphMargins.new(0.127, 0.127, 0.254, 0.254)
|
23
|
+
def parse(text_body_props_node)
|
20
24
|
text_body_props_node.attributes.each do |key, value|
|
21
25
|
case key
|
22
26
|
when 'bIns', 'marB'
|
23
|
-
|
27
|
+
@bottom = OoxmlSize.new(value.value.to_f, :emu)
|
24
28
|
when 'tIns', 'marT'
|
25
|
-
|
29
|
+
@top = OoxmlSize.new(value.value.to_f, :emu)
|
26
30
|
when 'lIns', 'marL'
|
27
|
-
|
31
|
+
@left = OoxmlSize.new(value.value.to_f, :emu)
|
28
32
|
when 'rIns', 'marR'
|
29
|
-
|
33
|
+
@right = OoxmlSize.new(value.value.to_f, :emu)
|
30
34
|
end
|
31
35
|
end
|
32
|
-
|
36
|
+
self
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
@@ -1,47 +1,46 @@
|
|
1
1
|
module OoxmlParser
|
2
|
-
class TableMargins
|
2
|
+
class TableMargins < OOXMLDocumentObject
|
3
3
|
attr_accessor :is_default, :top, :bottom, :left, :right
|
4
4
|
|
5
|
-
def initialize(is_default = true, top = nil, bottom = nil, left = nil, right = nil)
|
5
|
+
def initialize(is_default = true, top = nil, bottom = nil, left = nil, right = nil, parent: nil)
|
6
6
|
@is_default = is_default
|
7
7
|
@top = top
|
8
8
|
@bottom = bottom
|
9
9
|
@left = left
|
10
10
|
@right = right
|
11
|
+
@parent = parent
|
11
12
|
end
|
12
13
|
|
14
|
+
# TODO: Separate @is_default attribute and remove this method
|
13
15
|
def ==(other)
|
14
|
-
|
15
|
-
|
16
|
+
instance_variables.each do |current_attribute|
|
17
|
+
next if current_attribute == :@parent
|
18
|
+
next if current_attribute == :@is_default
|
19
|
+
unless instance_variable_get(current_attribute) == other.instance_variable_get(current_attribute)
|
20
|
+
return false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
true
|
16
24
|
end
|
17
25
|
|
18
26
|
def to_s
|
19
27
|
'Default: ' + is_default.to_s + ' top: ' + @top.to_s + ', bottom: ' + @bottom.to_s + ', left: ' + @left.to_s + ', right: ' + @right.to_s
|
20
28
|
end
|
21
29
|
|
22
|
-
def
|
23
|
-
top = @top.round(count_of_digits)
|
24
|
-
bottom = @bottom.round(count_of_digits)
|
25
|
-
left = @left.round(count_of_digits)
|
26
|
-
right = @right.round(count_of_digits)
|
27
|
-
TableMargins.new(@is_default, top, bottom, left, right)
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.parse(margin_node)
|
31
|
-
cell_margins = TableMargins.new
|
30
|
+
def parse(margin_node)
|
32
31
|
margin_node.xpath('*').each do |cell_margin_node|
|
33
32
|
case cell_margin_node.name
|
34
33
|
when 'left'
|
35
|
-
|
34
|
+
@left = OoxmlSize.new(cell_margin_node.attribute('w').value.to_f)
|
36
35
|
when 'top'
|
37
|
-
|
36
|
+
@top = OoxmlSize.new(cell_margin_node.attribute('w').value.to_f)
|
38
37
|
when 'right'
|
39
|
-
|
38
|
+
@right = OoxmlSize.new(cell_margin_node.attribute('w').value.to_f)
|
40
39
|
when 'bottom'
|
41
|
-
|
40
|
+
@bottom = OoxmlSize.new(cell_margin_node.attribute('w').value.to_f)
|
42
41
|
end
|
43
42
|
end
|
44
|
-
|
43
|
+
self
|
45
44
|
end
|
46
45
|
end
|
47
46
|
end
|
@@ -1,20 +1,21 @@
|
|
1
|
-
require_relative 'whole_table/table_cell_style'
|
2
1
|
# Describe single table element
|
3
2
|
module OoxmlParser
|
4
|
-
class TableElement
|
3
|
+
class TableElement < OOXMLDocumentObject
|
5
4
|
attr_accessor :cell_style
|
6
5
|
|
7
6
|
alias cell_properties cell_style
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
# Parse TableElement object
|
9
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
10
|
+
# @return [TableElement] result of parsing
|
11
|
+
def parse(node)
|
12
|
+
node.xpath('*').each do |node_child|
|
13
|
+
case node_child.name
|
13
14
|
when 'tcStyle', 'tcPr'
|
14
|
-
|
15
|
+
@cell_style = CellProperties.new(parent: self).parse(node_child)
|
15
16
|
end
|
16
17
|
end
|
17
|
-
|
18
|
+
self
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
# Class for parsing `w:tblLayout` object
|
3
|
+
# Whether a table uses a fixed width or autofit method for laying out the table
|
4
|
+
# contents is specified with the <w:tblLayout> element within the <w:tblPr> element.
|
5
|
+
# If <w:tblLayout> is omitted, autofit is assumed.
|
6
|
+
class TableLayout < OOXMLDocumentObject
|
7
|
+
# @return [Symbol] Specifies the method of laying out the contents of the table
|
8
|
+
attr_accessor :type
|
9
|
+
|
10
|
+
# Parse TableLayout
|
11
|
+
# @param [Nokogiri::XML:Node] node with TableLayout
|
12
|
+
# @return [TableLayout] result of parsing
|
13
|
+
def parse(node)
|
14
|
+
node.attributes.each do |key, value|
|
15
|
+
case key
|
16
|
+
when 'type'
|
17
|
+
@type = value.value.to_sym
|
18
|
+
end
|
19
|
+
end
|
20
|
+
self
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Describe look of table
|
2
1
|
module OoxmlParser
|
2
|
+
# Describe look of table, parsed `w:tblLook`
|
3
3
|
class TableLook < OOXMLDocumentObject
|
4
4
|
attr_accessor :first_row, :first_column, :last_row, :last_column, :banding_row, :banding_column, :no_horizontal_banding,
|
5
5
|
:no_vertical_banding
|
6
6
|
|
7
|
-
def initialize
|
7
|
+
def initialize(parent: nil)
|
8
8
|
@first_row = false
|
9
9
|
@first_column = false
|
10
10
|
@last_row = false
|
@@ -13,31 +13,34 @@ module OoxmlParser
|
|
13
13
|
@banding_column = false
|
14
14
|
@no_horizontal_banding = false
|
15
15
|
@no_horizontal_banding = false
|
16
|
+
@parent = parent
|
16
17
|
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
# Parse TableLook object
|
20
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
21
|
+
# @return [TableLook] result of parsing
|
22
|
+
def parse(node)
|
23
|
+
node.attributes.each do |key, value|
|
21
24
|
case key
|
22
25
|
when 'firstRow'
|
23
|
-
|
26
|
+
@first_row = attribute_enabled?(value)
|
24
27
|
when 'lastRow'
|
25
|
-
|
28
|
+
@last_row = attribute_enabled?(value)
|
26
29
|
when 'firstCol', 'firstColumn'
|
27
|
-
|
30
|
+
@first_column = attribute_enabled?(value)
|
28
31
|
when 'lastCol', 'lastColumn'
|
29
|
-
|
32
|
+
@last_column = attribute_enabled?(value)
|
30
33
|
when 'noHBand'
|
31
|
-
|
34
|
+
@no_horizontal_banding = attribute_enabled?(value)
|
32
35
|
when 'noVBand'
|
33
|
-
|
36
|
+
@no_vertical_banding = attribute_enabled?(value)
|
34
37
|
when 'bandRow'
|
35
|
-
|
38
|
+
@banding_row = attribute_enabled?(value)
|
36
39
|
when 'bandCol'
|
37
|
-
|
40
|
+
@banding_column = attribute_enabled?(value)
|
38
41
|
end
|
39
42
|
end
|
40
|
-
|
43
|
+
self
|
41
44
|
end
|
42
45
|
end
|
43
46
|
end
|
@@ -1,49 +1,42 @@
|
|
1
1
|
# Table Position Data
|
2
2
|
module OoxmlParser
|
3
|
-
class TablePosition
|
3
|
+
class TablePosition < OOXMLDocumentObject
|
4
4
|
attr_accessor :left, :right, :top, :bottom, :position_x, :position_y, :horizontal_anchor, :vertical_anchor, :vertical_align_from_anchor,
|
5
5
|
:horizontal_align_from_anchor
|
6
6
|
|
7
|
-
def initialize
|
8
|
-
@left = nil
|
9
|
-
@right = nil
|
10
|
-
@top = nil
|
11
|
-
@bottom = nil
|
12
|
-
@position_x = nil
|
13
|
-
@position_y = nil
|
14
|
-
end
|
15
|
-
|
16
7
|
def to_s
|
17
8
|
'Table position left: ' + @left.to_s + ', right: ' + @right.to_s + ', top: ' + @top.to_s + ', bottom: ' + @bottom.to_s + 'position x: ' + position_x.to_s + 'position y: ' + position_x.to_s
|
18
9
|
end
|
19
10
|
|
20
|
-
|
21
|
-
|
11
|
+
# Parse TablePosition object
|
12
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
13
|
+
# @return [TablePosition] result of parsing
|
14
|
+
def parse(node)
|
22
15
|
node.attributes.each do |key, value|
|
23
16
|
case key
|
24
17
|
when 'leftFromText'
|
25
|
-
|
18
|
+
@left = OoxmlSize.new(value.value.to_f)
|
26
19
|
when 'rightFromText'
|
27
|
-
|
20
|
+
@right = OoxmlSize.new(value.value.to_f)
|
28
21
|
when 'topFromText'
|
29
|
-
|
22
|
+
@top = OoxmlSize.new(value.value.to_f)
|
30
23
|
when 'bottomFromText'
|
31
|
-
|
24
|
+
@bottom = OoxmlSize.new(value.value.to_f)
|
32
25
|
when 'tblpX'
|
33
|
-
|
26
|
+
@position_x = OoxmlSize.new(value.value.to_f)
|
34
27
|
when 'tblpY'
|
35
|
-
|
28
|
+
@position_y = OoxmlSize.new(value.value.to_f)
|
36
29
|
when 'vertAnchor'
|
37
|
-
|
30
|
+
@vertical_anchor = value.value.to_sym
|
38
31
|
when 'horzAnchor'
|
39
|
-
|
32
|
+
@horizontal_anchor = value.value.to_sym
|
40
33
|
when 'tblpXSpec'
|
41
|
-
|
34
|
+
@horizontal_align_from_anchor = value.value.to_sym
|
42
35
|
when 'tblpYSpec'
|
43
|
-
|
36
|
+
@vertical_align_from_anchor = value.value.to_sym
|
44
37
|
end
|
45
38
|
end
|
46
|
-
|
39
|
+
self
|
47
40
|
end
|
48
41
|
end
|
49
42
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative 'table_style_elements'
|
2
1
|
require_relative 'table_element'
|
3
2
|
# Style of Table
|
4
3
|
module OoxmlParser
|
@@ -7,71 +6,53 @@ module OoxmlParser
|
|
7
6
|
:last_column, :first_column, :last_row, :first_row, :southeast_cell, :southwest_cell, :northeast_cell,
|
8
7
|
:northwest_cell
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
@banding_2_vertical = TableStyleElement.new
|
16
|
-
@last_column = TableStyleElement.new
|
17
|
-
@first_column = TableStyleElement.new
|
18
|
-
@last_row = TableStyleElement.new
|
19
|
-
@first_row = TableStyleElement.new
|
20
|
-
@southeast_cell = TableStyleElement.new
|
21
|
-
@southwest_cell = TableStyleElement.new
|
22
|
-
@northeast_cell = TableStyleElement.new
|
23
|
-
@northwest_cell = TableStyleElement.new
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.parse(style_id: nil, table_style_node: nil)
|
27
|
-
table_style = TableStyle.new
|
28
|
-
if !style_id.nil?
|
9
|
+
# Parse TableStyle object
|
10
|
+
# @param style_id [String] id to parse
|
11
|
+
# @return [TableStyle] result of parsing
|
12
|
+
def parse(style_id: nil)
|
13
|
+
unless style_id.nil?
|
29
14
|
nodes = get_style_node(style_id)
|
30
15
|
return nil if nodes.nil?
|
31
16
|
xpath = '*'
|
32
17
|
attributes = 'style_node_child.name'
|
33
|
-
elsif !table_style_node.nil?
|
34
|
-
nodes = table_style_node
|
35
|
-
xpath = 'w:tblStylePr'
|
36
|
-
attributes = "style_node_child.attribute('type').value"
|
37
18
|
end
|
38
19
|
begin
|
39
20
|
nodes.xpath(xpath).each do |style_node_child|
|
40
21
|
case instance_eval(attributes)
|
41
22
|
when 'wholeTbl'
|
42
|
-
|
23
|
+
@whole_table = TableElement.new(parent: self).parse(style_node_child)
|
43
24
|
when 'band1H'
|
44
|
-
|
25
|
+
@banding_1_horizontal = TableElement.new(parent: self).parse(style_node_child)
|
45
26
|
when 'band2H', 'band2Horz'
|
46
|
-
|
27
|
+
@banding_2_horizontal = TableElement.new(parent: self).parse(style_node_child)
|
47
28
|
when 'band1V'
|
48
|
-
|
29
|
+
@banding_1_vertical = TableElement.new(parent: self).parse(style_node_child)
|
49
30
|
when 'band2V'
|
50
|
-
|
31
|
+
@banding_2_vertical = TableElement.new(parent: self).parse(style_node_child)
|
51
32
|
when 'lastCol'
|
52
|
-
|
33
|
+
@last_column = TableElement.new(parent: self).parse(style_node_child)
|
53
34
|
when 'firstCol'
|
54
|
-
|
35
|
+
@first_column = TableElement.new(parent: self).parse(style_node_child)
|
55
36
|
when 'lastRow'
|
56
|
-
|
37
|
+
@last_row = TableElement.new(parent: self).parse(style_node_child)
|
57
38
|
when 'firstRow'
|
58
|
-
|
39
|
+
@first_row = TableElement.new(parent: self).parse(style_node_child)
|
59
40
|
when 'seCell'
|
60
|
-
|
41
|
+
@southeast_cell = TableElement.new(parent: self).parse(style_node_child)
|
61
42
|
when 'swCell'
|
62
|
-
|
43
|
+
@southwest_cell = TableElement.new(parent: self).parse(style_node_child)
|
63
44
|
when 'neCell'
|
64
|
-
|
45
|
+
@northeast_cell = TableElement.new(parent: self).parse(style_node_child)
|
65
46
|
when 'nwCell'
|
66
|
-
|
47
|
+
@northwest_cell = TableElement.new(parent: self).parse(style_node_child)
|
67
48
|
end
|
68
49
|
end
|
69
50
|
end
|
70
|
-
|
71
|
-
|
51
|
+
@id = style_id unless style_id.nil?
|
52
|
+
self
|
72
53
|
end
|
73
54
|
|
74
|
-
def
|
55
|
+
def get_style_node(style_id)
|
75
56
|
begin
|
76
57
|
doc = Nokogiri::XML(File.open(OOXMLDocumentObject.path_to_folder + 'ppt/tableStyles.xml'))
|
77
58
|
rescue StandardError
|
data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
# Class for parsing `w:tblStyleColBandSize` object
|
3
|
+
# When a style specifies the format for a band of columns in a
|
4
|
+
# table (a set of contiguous columns),
|
5
|
+
# this specifies the number of columns in a band.
|
6
|
+
class TableStyleColumnBandSize < OOXMLDocumentObject
|
7
|
+
# @return [Integer] value of table style column band size
|
8
|
+
attr_accessor :value
|
9
|
+
|
10
|
+
# Parse TableStyleColumnBandSize
|
11
|
+
# @param [Nokogiri::XML:Node] node with TableStyleColumnBandSize
|
12
|
+
# @return [TableStyleColumnBandSize] result of parsing
|
13
|
+
def parse(node)
|
14
|
+
node.attributes.each do |key, value|
|
15
|
+
case key
|
16
|
+
when 'val'
|
17
|
+
@value = value.value.to_i
|
18
|
+
end
|
19
|
+
end
|
20
|
+
self
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
# Helper method for working with TableStyleProperties
|
3
|
+
module TableStylePropertiesHelper
|
4
|
+
TABLE_STYLES_NAMES_HASH = { first_column: :firstCol,
|
5
|
+
last_column: :lastCol,
|
6
|
+
whole_table: :wholeTbl,
|
7
|
+
banding_1_horizontal: :band1Horz,
|
8
|
+
banding_2_horizontal: :band2Horz,
|
9
|
+
banding_1_vertical: :band1Vert,
|
10
|
+
banding_2_vertical: :band2Vert,
|
11
|
+
southeast_cell: :seCell,
|
12
|
+
southwest_cell: :swCell,
|
13
|
+
northeast_cell: :neCell,
|
14
|
+
northwest_cell: :nwCell,
|
15
|
+
first_row: :firstRow,
|
16
|
+
last_row: :lastRow }.freeze
|
17
|
+
|
18
|
+
TABLE_STYLES_NAMES_HASH.keys.each do |table_style_name|
|
19
|
+
define_method(table_style_name) do
|
20
|
+
@table_style_properties_list.each do |table_style|
|
21
|
+
return table_style if table_style.type == TABLE_STYLES_NAMES_HASH[table_style_name]
|
22
|
+
end
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Fill all empty tables styles with default value
|
28
|
+
# To make last changes in parsing table styles compatible
|
29
|
+
# with `ooxml_parser` 0.1.2 and earlier
|
30
|
+
# @return [Nothing]
|
31
|
+
def fill_empty_table_styles
|
32
|
+
TABLE_STYLES_NAMES_HASH.values.each do |current_table_style|
|
33
|
+
style_exist = false
|
34
|
+
@table_style_properties_list.each do |existing_style|
|
35
|
+
style_exist = true if existing_style.type == current_table_style
|
36
|
+
end
|
37
|
+
next if style_exist
|
38
|
+
@table_style_properties_list << TableStyleProperties.new(type: current_table_style)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|