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,17 +1,23 @@
|
|
1
1
|
# noinspection RubyTooManyInstanceVariablesInspection
|
2
|
+
require_relative 'docx_paragraph/bookmark'
|
2
3
|
require_relative 'docx_paragraph/docx_paragraph_run'
|
3
4
|
require_relative 'docx_paragraph/indents'
|
5
|
+
require_relative 'docx_paragraph/inserted'
|
4
6
|
require_relative 'docx_paragraph/frame_properties'
|
5
7
|
require_relative 'docx_paragraph/docx_formula'
|
6
|
-
require_relative 'docx_paragraph/
|
8
|
+
require_relative 'docx_paragraph/style_parametres'
|
7
9
|
module OoxmlParser
|
8
10
|
class DocxParagraph < OOXMLDocumentObject
|
9
11
|
attr_accessor :number, :bookmark_start, :bookmark_end, :align, :spacing, :background_color, :ind, :numbering,
|
10
12
|
:character_style_array, :horizontal_line, :page_break, :kinoku, :borders, :keep_lines,
|
11
13
|
:contextual_spacing, :sector_properties, :page_numbering, :section_break, :style, :keep_next,
|
12
|
-
:orphan_control, :
|
14
|
+
:orphan_control, :frame_properties
|
15
|
+
# @return [ParagraphProperties] Properties of current paragraph
|
16
|
+
attr_accessor :paragraph_properties
|
17
|
+
# @return [Inserted] data inserted by review
|
18
|
+
attr_accessor :inserted
|
13
19
|
|
14
|
-
def initialize
|
20
|
+
def initialize(parent: nil)
|
15
21
|
@number = 0
|
16
22
|
@bookmark_start = []
|
17
23
|
@bookmark_end = []
|
@@ -33,8 +39,8 @@ module OoxmlParser
|
|
33
39
|
@style = nil
|
34
40
|
@keep_next = false
|
35
41
|
@orphan_control = true
|
36
|
-
@tabs = []
|
37
42
|
@frame_properties = nil
|
43
|
+
@parent = parent
|
38
44
|
end
|
39
45
|
|
40
46
|
def copy
|
@@ -45,7 +51,7 @@ module OoxmlParser
|
|
45
51
|
paragraph.align = @align
|
46
52
|
paragraph.spacing = @spacing.copy
|
47
53
|
paragraph.background_color = @background_color
|
48
|
-
paragraph.ind = @ind.
|
54
|
+
paragraph.ind = @ind.dup
|
49
55
|
paragraph.numbering = @numbering
|
50
56
|
paragraph.character_style_array = @character_style_array
|
51
57
|
paragraph.horizontal_line = @horizontal_line
|
@@ -60,21 +66,33 @@ module OoxmlParser
|
|
60
66
|
paragraph.style = @style
|
61
67
|
paragraph.keep_next = @keep_next
|
62
68
|
paragraph.orphan_control = @orphan_control
|
63
|
-
paragraph.tabs = @tabs.dup
|
64
69
|
paragraph.frame_properties = @frame_properties
|
70
|
+
paragraph.paragraph_properties = @paragraph_properties
|
71
|
+
paragraph.inserted = @inserted
|
65
72
|
paragraph
|
66
73
|
end
|
67
74
|
|
68
75
|
def nonempty_runs
|
69
76
|
@character_style_array.select do |cur_run|
|
70
77
|
if cur_run.is_a?(DocxParagraphRun)
|
71
|
-
(!cur_run.text.empty? ||
|
78
|
+
(!cur_run.text.empty? ||
|
79
|
+
!cur_run.alternate_content.nil? ||
|
80
|
+
!cur_run.drawing.nil? ||
|
81
|
+
!cur_run.object.nil? ||
|
82
|
+
!cur_run.footnote.nil? ||
|
83
|
+
!cur_run.endnote.nil?
|
84
|
+
)
|
72
85
|
elsif cur_run.is_a?(DocxFormula)
|
73
86
|
true
|
74
87
|
end
|
75
88
|
end
|
76
89
|
end
|
77
90
|
|
91
|
+
# @return [True, false] if structure contain any user data
|
92
|
+
def with_data?
|
93
|
+
!nonempty_runs.empty?
|
94
|
+
end
|
95
|
+
|
78
96
|
def remove_empty_runs
|
79
97
|
nonempty = nonempty_runs
|
80
98
|
@character_style_array.each do |cur_run|
|
@@ -83,13 +101,7 @@ module OoxmlParser
|
|
83
101
|
end
|
84
102
|
|
85
103
|
def ==(other)
|
86
|
-
|
87
|
-
character_style_array.delete(current_run) if current_run.text.empty?
|
88
|
-
end
|
89
|
-
other.character_style_array.each do |current_run|
|
90
|
-
other.character_style_array.delete(current_run) if current_run.text.empty?
|
91
|
-
end
|
92
|
-
ignored_attributes = [:@number]
|
104
|
+
ignored_attributes = [:@number, :@parent]
|
93
105
|
all_instance_variables = instance_variables
|
94
106
|
significan_attribues = all_instance_variables - ignored_attributes
|
95
107
|
significan_attribues.each do |current_attributes|
|
@@ -100,210 +112,172 @@ module OoxmlParser
|
|
100
112
|
true
|
101
113
|
end
|
102
114
|
|
103
|
-
def
|
104
|
-
|
115
|
+
def parse(node, par_number = 0, default_character = DocxParagraphRun.new, parent: nil)
|
116
|
+
@parent = parent
|
105
117
|
default_character_style = default_character.copy
|
106
118
|
character_styles_array = []
|
107
|
-
custom_character_style =
|
119
|
+
custom_character_style = default_character_style.copy
|
108
120
|
char_number = 0
|
109
121
|
comments = []
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
DocxParagraph.parse_paragraph_style(p_props, paragraph_style, custom_character_style)
|
120
|
-
p_tag.xpath('w:pict').each do |pict|
|
122
|
+
node.xpath('*').each do |node_child|
|
123
|
+
case node_child.name
|
124
|
+
when 'bookmarkStart'
|
125
|
+
@bookmark_start << Bookmark.new(parent: self).parse(node_child)
|
126
|
+
when 'bookmarkEnd'
|
127
|
+
@bookmark_end << Bookmark.new(parent: self).parse(node_child)
|
128
|
+
when 'pPr'
|
129
|
+
parse_paragraph_style(node_child, custom_character_style)
|
130
|
+
node.xpath('w:pict').each do |pict|
|
121
131
|
pict.xpath('v:rect').each do
|
122
|
-
|
132
|
+
@horizontal_line = true
|
123
133
|
end
|
124
134
|
end
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
character_style
|
135
|
+
@paragraph_properties = ParagraphProperties.new(parent: self).parse(node_child)
|
136
|
+
when 'commentRangeStart'
|
137
|
+
comments << node_child.attribute('id').value
|
138
|
+
when 'fldSimple'
|
139
|
+
instruction = node_child.attribute('instr').to_s
|
140
|
+
@page_numbering = true if instruction.include?('PAGE')
|
141
|
+
node_child.xpath('w:r').each do |r_tag|
|
142
|
+
character_style = default_character_style.copy
|
143
|
+
character_style.parse(r_tag, char_number, parent: parent)
|
144
|
+
character_style.page_number = @page_numbering
|
133
145
|
character_style.instruction = instruction
|
134
146
|
character_styles_array << character_style.copy
|
135
147
|
char_number += 1
|
136
148
|
end
|
137
|
-
|
149
|
+
when 'r'
|
138
150
|
character_style = custom_character_style.copy
|
139
|
-
|
140
|
-
if insrt_text.text.include?('PAGE')
|
141
|
-
paragraph_style.page_numbering = true
|
142
|
-
end
|
151
|
+
node_child.xpath('w:instrText').each do |insrt_text|
|
152
|
+
@page_numbering = true if insrt_text.text.include?('PAGE')
|
143
153
|
end
|
144
|
-
character_style
|
154
|
+
character_style.parse(node_child, char_number, parent: self)
|
145
155
|
character_style.comments = comments.dup
|
146
156
|
character_styles_array << character_style.copy
|
147
157
|
unless character_style.shape.nil?
|
148
158
|
character_styles_array.last.shape = character_style.shape
|
149
159
|
end
|
150
160
|
char_number += 1
|
151
|
-
|
161
|
+
when 'hyperlink'
|
152
162
|
character_style = default_character_style.copy
|
153
|
-
if !
|
154
|
-
character_style.link = Hyperlink.parse(
|
163
|
+
if !node_child.attribute('id').nil?
|
164
|
+
character_style.link = Hyperlink.new(parent: character_style).parse(node_child)
|
155
165
|
else
|
156
|
-
unless
|
157
|
-
character_style.link =
|
166
|
+
unless node_child.attribute('anchor').nil?
|
167
|
+
character_style.link = node_child.attribute('anchor').value
|
158
168
|
end
|
159
169
|
end
|
160
|
-
|
161
|
-
character_style
|
170
|
+
node_child.xpath('w:r').each do |r_tag|
|
171
|
+
character_style.parse(r_tag, char_number, parent: parent)
|
162
172
|
character_styles_array << character_style.copy
|
163
173
|
char_number += 1
|
164
174
|
end
|
165
|
-
|
175
|
+
node_child.xpath('w:fldSimple').each do |simple_field|
|
166
176
|
instruction = simple_field.attribute('instr').to_s
|
167
|
-
|
177
|
+
@page_numbering = true if instruction.include?('PAGE')
|
168
178
|
simple_field.xpath('w:r').each do |r_tag|
|
169
|
-
character_style
|
170
|
-
character_style.page_number =
|
179
|
+
character_style.parse(r_tag, char_number, parent: self)
|
180
|
+
character_style.page_number = @page_numbering
|
171
181
|
character_style.instruction = instruction
|
172
182
|
character_styles_array << character_style.copy
|
173
183
|
char_number += 1
|
174
184
|
end
|
175
185
|
end
|
176
|
-
|
177
|
-
|
178
|
-
character_styles_array << DocxFormula.parse(o_math)
|
186
|
+
when 'oMathPara'
|
187
|
+
node_child.xpath('m:oMath').each do |o_math|
|
188
|
+
character_styles_array << DocxFormula.new(parent: self).parse(o_math)
|
179
189
|
end
|
180
|
-
|
190
|
+
when 'commentRangeEnd'
|
181
191
|
comments.each_with_index do |comment, index|
|
182
|
-
if comment ==
|
192
|
+
if comment == node_child.attribute('id').value
|
183
193
|
comments.delete_at(index)
|
184
194
|
break
|
185
195
|
end
|
186
196
|
end
|
197
|
+
when 'ins'
|
198
|
+
@inserted = Inserted.new(parent: self).parse(node_child)
|
187
199
|
end
|
188
200
|
end
|
189
|
-
|
201
|
+
@number = par_number
|
190
202
|
if character_styles_array.last.class == DocxParagraphRun
|
191
203
|
character_styles_array.last.text = character_styles_array.last.text.rstrip
|
192
204
|
end
|
193
|
-
|
194
|
-
|
205
|
+
@character_style_array = character_styles_array
|
206
|
+
@parent = parent
|
207
|
+
self
|
195
208
|
end
|
196
209
|
|
197
|
-
def
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
paragraph_style.page_break = true
|
204
|
-
end
|
205
|
-
end
|
206
|
-
paragraph_pr_tag.xpath('w:pBdr').each do |paragraph_br|
|
207
|
-
paragraph_style.borders = Borders.new
|
208
|
-
paragraph_br.xpath('w:bottom').each do |bottom|
|
209
|
-
paragraph_style.borders.bottom = BordersProperties.parse(bottom)
|
210
|
-
end
|
211
|
-
paragraph_br.xpath('w:left').each do |left|
|
212
|
-
paragraph_style.borders.left = BordersProperties.parse(left)
|
213
|
-
end
|
214
|
-
paragraph_br.xpath('w:top').each do |top|
|
215
|
-
paragraph_style.borders.top = BordersProperties.parse(top)
|
216
|
-
end
|
217
|
-
paragraph_br.xpath('w:right').each do |right|
|
218
|
-
paragraph_style.borders.right = BordersProperties.parse(right)
|
219
|
-
end
|
220
|
-
paragraph_br.xpath('w:between').each do |between|
|
221
|
-
paragraph_style.borders.between = BordersProperties.parse(between)
|
222
|
-
end
|
223
|
-
paragraph_br.xpath('w:bar').each do |bar|
|
224
|
-
paragraph_style.borders.bar = BordersProperties.parse(bar)
|
225
|
-
end
|
226
|
-
end
|
227
|
-
paragraph_pr_tag.xpath('w:keepLines').each do |keep_lines|
|
228
|
-
if keep_lines.attribute('val').nil?
|
229
|
-
paragraph_style.keep_lines = true
|
230
|
-
else
|
231
|
-
unless keep_lines.attribute('val').value == 'false'
|
232
|
-
paragraph_style.keep_lines = true
|
210
|
+
def parse_paragraph_style(node, default_char_style = DocxParagraphRun.new)
|
211
|
+
node.xpath('*').each do |node_child|
|
212
|
+
case node_child.name
|
213
|
+
when 'pageBreakBefore'
|
214
|
+
if node_child.attribute('val').nil? || node_child.attribute('val').value != 'false'
|
215
|
+
@page_break = true
|
233
216
|
end
|
217
|
+
when 'pBdr'
|
218
|
+
@borders = ParagraphBorders.new(parent: self).parse(node_child)
|
219
|
+
when 'keepLines'
|
220
|
+
if node_child.attribute('val').nil?
|
221
|
+
@keep_lines = true
|
222
|
+
else
|
223
|
+
unless node_child.attribute('val').value == 'false'
|
224
|
+
@keep_lines = true
|
225
|
+
end
|
226
|
+
end
|
227
|
+
when 'widowControl'
|
228
|
+
@orphan_control = option_enabled?(node_child)
|
229
|
+
when 'keepNext'
|
230
|
+
@keep_next = true
|
231
|
+
when 'contextualSpacing'
|
232
|
+
@contextual_spacing = true
|
233
|
+
when 'shd'
|
234
|
+
background_color_string = node_child.attribute('fill').value
|
235
|
+
@background_color = Color.new(parent: self).parse_hex_string(background_color_string)
|
236
|
+
unless node_child.attribute('val').nil?
|
237
|
+
@background_color.set_style(node_child.attribute('val').value)
|
238
|
+
end
|
239
|
+
when 'pStyle'
|
240
|
+
DocxParagraph.parse_paragraph_style_xml(node_child.attribute('val').value, self, default_char_style)
|
241
|
+
when 'ind'
|
242
|
+
@ind = DocumentStructure.default_paragraph_style.ind.dup.parse(node_child)
|
243
|
+
when 'kinoku'
|
244
|
+
@kinoku = true
|
245
|
+
when 'framePr'
|
246
|
+
@frame_properties = FrameProperties.new(parent: self).parse(node_child)
|
247
|
+
when 'numPr'
|
248
|
+
@numbering = NumberingProperties.new(parent: self).parse(node_child)
|
249
|
+
when 'jc'
|
250
|
+
@align = node_child.attribute('val').value.to_sym unless node_child.attribute('val').nil?
|
251
|
+
@align = :justify if node_child.attribute('val').value == 'both'
|
252
|
+
when 'spacing'
|
253
|
+
unless node_child.attribute('before').nil?
|
254
|
+
@spacing.before = (node_child.attribute('before').value.to_f / 566.9).round(2)
|
255
|
+
end
|
256
|
+
unless node_child.attribute('after').nil?
|
257
|
+
@spacing.after = (node_child.attribute('after').value.to_f / 566.9).round(2)
|
258
|
+
end
|
259
|
+
unless node_child.attribute('lineRule').nil?
|
260
|
+
@spacing.line_rule = node_child.attribute('lineRule').value.sub('atLeast', 'at_least').to_sym
|
261
|
+
end
|
262
|
+
unless node_child.attribute('line').nil?
|
263
|
+
@spacing.line = (@spacing.line_rule == :auto ? (node_child.attribute('line').value.to_f / 240.0).round(2) : (node_child.attribute('line').value.to_f / 566.9).round(2))
|
264
|
+
end
|
265
|
+
when 'sectPr'
|
266
|
+
@sector_properties = PageProperties.new(parent: self).parse(node_child, self, default_char_style)
|
267
|
+
@section_break = case @sector_properties.type
|
268
|
+
when 'oddPage'
|
269
|
+
'Odd page'
|
270
|
+
when 'evenPage'
|
271
|
+
'Even page'
|
272
|
+
when 'continuous'
|
273
|
+
'Current Page'
|
274
|
+
else
|
275
|
+
'Next Page'
|
276
|
+
end
|
234
277
|
end
|
235
278
|
end
|
236
|
-
|
237
|
-
|
238
|
-
end
|
239
|
-
paragraph_pr_tag.xpath('w:keepNext').each do |_|
|
240
|
-
paragraph_style.keep_next = true
|
241
|
-
end
|
242
|
-
paragraph_style.contextual_spacing = true unless paragraph_pr_tag.xpath('w:contextualSpacing').empty?
|
243
|
-
paragraph_pr_tag.xpath('w:shd').each do |shd|
|
244
|
-
background_color_string = shd.attribute('fill').value
|
245
|
-
paragraph_style.background_color = Color.from_int16(background_color_string)
|
246
|
-
unless shd.attribute('val').nil?
|
247
|
-
paragraph_style.background_color.set_style(shd.attribute('val').value)
|
248
|
-
end
|
249
|
-
end
|
250
|
-
paragraph_pr_tag.xpath('w:pStyle').each do |p_style|
|
251
|
-
parse_paragraph_style_xml(p_style.attribute('val').value, paragraph_style, default_char_style)
|
252
|
-
end
|
253
|
-
paragraph_pr_tag.xpath('w:ind').each do |ind|
|
254
|
-
paragraph_style.ind = Indents.parse(ind)
|
255
|
-
end
|
256
|
-
paragraph_pr_tag.xpath('w:kinoku').each do
|
257
|
-
paragraph_style.kinoku = true
|
258
|
-
end
|
259
|
-
paragraph_pr_tag.xpath('w:framePr').each do |frame_pr_node|
|
260
|
-
paragraph_style.frame_properties = FrameProperties.parse(frame_pr_node)
|
261
|
-
end
|
262
|
-
paragraph_pr_tag.xpath('w:numPr').each do |num_pr|
|
263
|
-
numbering = Numbering.new
|
264
|
-
num_pr.xpath('w:ilvl').each do |ilvl|
|
265
|
-
numbering.ilvl = ilvl.attribute('val').value
|
266
|
-
end
|
267
|
-
num_pr.xpath('w:numId').each do |num_id|
|
268
|
-
numbering.numbering_properties = NumberingProperties.parse(num_id.attribute('val').value) if File.exist?(OOXMLDocumentObject.path_to_folder + 'word/numbering.xml')
|
269
|
-
end
|
270
|
-
paragraph_style.numbering = numbering
|
271
|
-
end
|
272
|
-
paragraph_pr_tag.xpath('w:jc').each do |jc|
|
273
|
-
paragraph_style.align = jc.attribute('val').value.to_sym unless jc.attribute('val').nil?
|
274
|
-
paragraph_style.align = :justify if jc.attribute('val').value == 'both'
|
275
|
-
end
|
276
|
-
paragraph_pr_tag.xpath('w:framePr').each do |frame_pr_node|
|
277
|
-
paragraph_style.frame_properties = FrameProperties.parse(frame_pr_node)
|
278
|
-
end
|
279
|
-
paragraph_pr_tag.xpath('w:spacing').each do |spacing|
|
280
|
-
unless spacing.attribute('before').nil?
|
281
|
-
paragraph_style.spacing.before = (spacing.attribute('before').value.to_f / 566.9).round(2)
|
282
|
-
end
|
283
|
-
unless spacing.attribute('after').nil?
|
284
|
-
paragraph_style.spacing.after = (spacing.attribute('after').value.to_f / 566.9).round(2)
|
285
|
-
end
|
286
|
-
unless spacing.attribute('lineRule').nil?
|
287
|
-
paragraph_style.spacing.line_rule = spacing.attribute('lineRule').value.sub('atLeast', 'at_least').to_sym
|
288
|
-
end
|
289
|
-
unless spacing.attribute('line').nil?
|
290
|
-
paragraph_style.spacing.line = (paragraph_style.spacing.line_rule == :auto ? (spacing.attribute('line').value.to_f / 240.0).round(2) : (spacing.attribute('line').value.to_f / 566.9).round(2))
|
291
|
-
end
|
292
|
-
end
|
293
|
-
paragraph_pr_tag.xpath('w:sectPr').each do |sect_pr|
|
294
|
-
paragraph_style.sector_properties = PageProperties.parse(sect_pr, paragraph_style, default_char_style)
|
295
|
-
paragraph_style.section_break = case paragraph_style.sector_properties.type
|
296
|
-
when 'oddPage'
|
297
|
-
'Odd page'
|
298
|
-
when 'evenPage'
|
299
|
-
'Even page'
|
300
|
-
when 'continuous'
|
301
|
-
'Current Page'
|
302
|
-
else
|
303
|
-
'Next Page'
|
304
|
-
end
|
305
|
-
end
|
306
|
-
paragraph_style
|
279
|
+
@parent = parent
|
280
|
+
self
|
307
281
|
end
|
308
282
|
|
309
283
|
def self.parse_paragraph_style_xml(id, paragraph_style, character_style)
|
@@ -311,11 +285,11 @@ module OoxmlParser
|
|
311
285
|
doc.search('//w:style').each do |style|
|
312
286
|
next unless style.attribute('styleId').value == id
|
313
287
|
style.xpath('w:pPr').each do |p_pr|
|
314
|
-
parse_paragraph_style(p_pr,
|
315
|
-
paragraph_style.style = StyleParametres.parse(style)
|
288
|
+
paragraph_style.parse_paragraph_style(p_pr, character_style)
|
289
|
+
paragraph_style.style = StyleParametres.new(parent: paragraph_style).parse(style)
|
316
290
|
end
|
317
291
|
style.xpath('w:rPr').each do |r_pr|
|
318
|
-
|
292
|
+
character_style.parse_properties(r_pr, DocumentStructure.default_run_style)
|
319
293
|
end
|
320
294
|
break
|
321
295
|
end
|
@@ -1,37 +1,56 @@
|
|
1
1
|
module OoxmlParser
|
2
|
+
# Class Header Footer classes
|
2
3
|
class HeaderFooter < OOXMLDocumentObject
|
3
|
-
attr_accessor :id, :
|
4
|
+
attr_accessor :id, :elements, :type
|
5
|
+
attr_accessor :path_suffix
|
4
6
|
|
5
|
-
def initialize(type = :header)
|
7
|
+
def initialize(type = :header, parent: nil)
|
6
8
|
@type = type
|
9
|
+
@elements = []
|
10
|
+
@parent = parent
|
7
11
|
end
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
# @return [String] string for search of xpath
|
14
|
+
def xpath_for_search
|
15
|
+
"//w:#{path_suffix}"
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [String] string with xml path
|
19
|
+
def xml_path
|
20
|
+
"word/#{path_suffix}s.xml"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Parse type and path suffix by node type
|
24
|
+
# @param [Nokogiri::XML:Node] node with HeaderFooter
|
25
|
+
def parse_type(node)
|
26
|
+
case node.name
|
27
|
+
when 'footnoteReference'
|
28
|
+
@path_suffix = 'footnote'
|
29
|
+
@type = :header
|
30
|
+
when 'endnoteReference'
|
31
|
+
@path_suffix = 'endnote'
|
32
|
+
@type = :footer
|
33
|
+
else
|
34
|
+
warn "Unknown HeaderFooter type: #{node.name}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Parse HeaderFooter
|
39
|
+
# @param [Nokogiri::XML:Node] node with HeaderFooter
|
40
|
+
# @return [HeaderFooter] result of parsing
|
41
|
+
def parse(node)
|
42
|
+
@id = node.attribute('id').value.to_i
|
43
|
+
parse_type(node)
|
44
|
+
doc = Nokogiri::XML(File.open(OOXMLDocumentObject.path_to_folder + xml_path))
|
45
|
+
doc.search(xpath_for_search).each do |footnote|
|
46
|
+
next unless footnote.attribute('id').value.to_i == @id
|
47
|
+
paragraph_number = 0
|
48
|
+
footnote.xpath('w:p').each do |paragraph|
|
49
|
+
@elements << DocumentStructure.default_paragraph_style.copy.parse(paragraph, paragraph_number, DocumentStructure.default_run_style, parent: self)
|
50
|
+
paragraph_number += 1
|
33
51
|
end
|
34
52
|
end
|
53
|
+
self
|
35
54
|
end
|
36
55
|
end
|
37
56
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
# This element specifies the type of numbering defined by a given abstract numbering type
|
3
|
+
class MultilevelType < OOXMLDocumentObject
|
4
|
+
# @return [String] value of Multilevel Type
|
5
|
+
attr_accessor :value
|
6
|
+
|
7
|
+
# Parse MultilevelType
|
8
|
+
# @param [Nokogiri::XML:Node] node with MultilevelType
|
9
|
+
# @return [MultilevelType] result of parsing
|
10
|
+
def parse(node)
|
11
|
+
node.attributes.each do |key, value|
|
12
|
+
case key
|
13
|
+
when 'val'
|
14
|
+
@value = value_to_symbol(value)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
# Class for storing Level Justification, `lvlJc` tag
|
3
|
+
class LevelJustification < OOXMLDocumentObject
|
4
|
+
# @return [String] value of start
|
5
|
+
attr_accessor :value
|
6
|
+
|
7
|
+
# Parse LevelJustification
|
8
|
+
# @param [Nokogiri::XML:Node] node with LevelJustification
|
9
|
+
# @return [LevelJustification] result of parsing
|
10
|
+
def parse(node)
|
11
|
+
node.attributes.each do |key, value|
|
12
|
+
case key
|
13
|
+
when 'val'
|
14
|
+
@value = value.value.to_s
|
15
|
+
end
|
16
|
+
end
|
17
|
+
self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
# Class for storing Level Text, `lvlText` tag
|
3
|
+
class LevelText < OOXMLDocumentObject
|
4
|
+
# @return [String] value of start
|
5
|
+
attr_accessor :value
|
6
|
+
|
7
|
+
# Parse LevelText
|
8
|
+
# @param [Nokogiri::XML:Node] node with LevelText
|
9
|
+
# @return [LevelText] result of parsing
|
10
|
+
def parse(node)
|
11
|
+
node.attributes.each do |key, value|
|
12
|
+
case key
|
13
|
+
when 'val'
|
14
|
+
@value = value.value.to_s
|
15
|
+
end
|
16
|
+
end
|
17
|
+
self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
# Class for storing Numbering Format data, `numFmt` tag
|
3
|
+
class NumberingFormat < OOXMLDocumentObject
|
4
|
+
# @return [String] value of start
|
5
|
+
attr_accessor :value
|
6
|
+
|
7
|
+
# Parse NumberingFormat
|
8
|
+
# @param [Nokogiri::XML:Node] node with NumberingFormat
|
9
|
+
# @return [NumberingFormat] result of parsing
|
10
|
+
def parse(node)
|
11
|
+
node.attributes.each do |key, value|
|
12
|
+
case key
|
13
|
+
when 'val'
|
14
|
+
@value = value.value.to_s
|
15
|
+
end
|
16
|
+
end
|
17
|
+
self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
# Class for storing Start data, `start` tag
|
3
|
+
class Start < OOXMLDocumentObject
|
4
|
+
# @return [Integer] value of start
|
5
|
+
attr_accessor :value
|
6
|
+
|
7
|
+
# Parse Start
|
8
|
+
# @param [Nokogiri::XML:Node] node with Start
|
9
|
+
# @return [Start] result of parsing
|
10
|
+
def parse(node)
|
11
|
+
node.attributes.each do |key, value|
|
12
|
+
case key
|
13
|
+
when 'val'
|
14
|
+
@value = value.value.to_f
|
15
|
+
end
|
16
|
+
end
|
17
|
+
self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
# Class for storing Suffix `w:suff`
|
3
|
+
# This element specifies the content which
|
4
|
+
# shall be added between a given numbering level's text and the text of
|
5
|
+
# every numbered paragraph which references that numbering level.
|
6
|
+
# If this element is omitted, then its value shall be assumed to be tab.
|
7
|
+
# >ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference 17.9.29.
|
8
|
+
class Suffix < OOXMLDocumentObject
|
9
|
+
# @return [String] value of suffix
|
10
|
+
attr_accessor :value
|
11
|
+
|
12
|
+
def initialize(value = :tab,
|
13
|
+
parent: nil)
|
14
|
+
@value = value
|
15
|
+
@parent = parent
|
16
|
+
end
|
17
|
+
|
18
|
+
# Parse Suffix
|
19
|
+
# @param [Nokogiri::XML:Node] node with Suffix
|
20
|
+
# @return [Suffix] result of parsing
|
21
|
+
def parse(node)
|
22
|
+
node.attributes.each do |key, value|
|
23
|
+
case key
|
24
|
+
when 'val'
|
25
|
+
@value = value.value.to_sym
|
26
|
+
end
|
27
|
+
end
|
28
|
+
self
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|