ooxml_parser 0.3.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ooxml_parser.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/chart_style.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +33 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats/pivot_format.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area.rb +67 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area/common_chart_data.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +20 -7
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +5 -3
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/{string_reference.rb → number_string_reference.rb} +9 -7
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/{string_cache.rb → number_string_cache.rb} +11 -6
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point.rb +9 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point/text_value.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/x_y_values.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/view_3d.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis/scaling.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +7 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_point.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +6 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing/doc_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +11 -8
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +23 -14
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_horizontal.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_vertical.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +7 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties/shape_placeholder.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties/preset_text_warp.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +5 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip/alpha_mod_fix.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list/shape_guide.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +12 -11
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +11 -5
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_element.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +22 -9
- data/lib/ooxml_parser/common_parser/common_data/color.rb +86 -70
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +25 -21
- data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +7 -3
- data/lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb +4 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +12 -8
- data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +6 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +5 -3
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +5 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +14 -14
- data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types.rb +36 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_default.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_override.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +11 -6
- data/lib/ooxml_parser/common_parser/common_data/font_style.rb +3 -2
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +19 -2
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +107 -116
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_object_attribute_helper.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +24 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +9 -8
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +9 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/text.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +5 -3
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +12 -25
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing/line_spacing.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/tab.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/relationships.rb +24 -19
- data/lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +3 -8
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_layout.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +9 -2
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +19 -17
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +4 -1
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_row_band_size.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +7 -4
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +21 -39
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line/line_join.rb +4 -4
- data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +5 -2
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties/table_row_height.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid/grid_column.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +26 -4
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties/table_borders.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_document_structure.rb +17 -0
- data/lib/ooxml_parser/common_parser/parser.rb +6 -2
- data/lib/ooxml_parser/configuration.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +73 -38
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments.rb +36 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +34 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended.rb +4 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended/comment_extended.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +3 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +6 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb +2 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +9 -12
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +71 -81
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_end.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_start.rb +26 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_end.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_start.rb +26 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties/argument_size.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +4 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_grow.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_limit_location.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +4 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_helper.rb +11 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +17 -20
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +11 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +39 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_margins.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_size.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/stroke.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb +41 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb +24 -8
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/structured_document_tag.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +3 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +4 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +7 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/multilevel_type.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +3 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_justification.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_text.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/numbering_format.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition.rb +4 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +7 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/footnote_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +13 -14
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +10 -8
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +4 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +12 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/paragraph_properties_default.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/run_properties_default.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_parser.rb +3 -0
- data/lib/ooxml_parser/helpers/string_helper.rb +3 -1
- data/lib/ooxml_parser/name.rb +8 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +30 -37
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors.rb +39 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors/comment_author.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb +33 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb +39 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_helpers.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +9 -3
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme.rb +36 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection.rb +31 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection/text_font.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +11 -8
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +8 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +4 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties/stretch.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/connection_shape.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +5 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +2 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_notes.rb +3 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +3 -9
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +4 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +6 -3
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/{condition.rb → codition_list/condition.rb} +3 -9
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition_list.rb +27 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +4 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb +5 -5
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +8 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties/wheel.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/table_styles.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +4 -1
- data/lib/ooxml_parser/version.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +38 -38
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table.rb +46 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table/string_index.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +13 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/{worksheet/xlsx_row/xlsx_cell → style_sheet/cell_xfs}/cell_style/alignment.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +145 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +5 -3
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +2 -5
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats/number_format.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders/xlsx_border.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb +3 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +51 -25
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +28 -29
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/author.rb +16 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/comment_list.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +10 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/ole_objects.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/page_setup.rb +105 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb +8 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb +12 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters/custom_filter.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns/table_column.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/worksheet_helper.rb +14 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +8 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +3 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +60 -27
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb +39 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +4 -1
- metadata +87 -29
- data/LICENSE.txt +0 -661
- data/README.md +0 -43
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/order.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_index.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point_count.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop/preset_color.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/language.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties/vertical_merge.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb +0 -30
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb +0 -28
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark.rb +0 -21
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/start.rb +0 -20
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition/abstract_numbering_id.rb +0 -20
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment.rb +0 -31
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb +0 -26
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style.rb +0 -128
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# noinspection RubyInstanceMethodNamingConvention
|
2
|
-
require_relative 'document_structure/
|
4
|
+
require_relative 'document_structure/comments'
|
3
5
|
require_relative 'document_structure/comments_extended'
|
4
6
|
require_relative 'document_structure/docx_paragraph'
|
5
7
|
require_relative 'document_structure/document_background'
|
@@ -12,20 +14,23 @@ require_relative 'document_structure/page_properties/page_properties'
|
|
12
14
|
require_relative 'document_structure/document_settings'
|
13
15
|
require_relative 'document_structure/styles'
|
14
16
|
module OoxmlParser
|
17
|
+
# Basic class for DocumentStructure
|
15
18
|
class DocumentStructure < CommonDocumentStructure
|
16
19
|
include DocumentStyleHelper
|
17
20
|
include DocumentStructureHelpers
|
18
21
|
attr_accessor :elements, :page_properties, :notes, :background, :document_properties, :comments
|
19
22
|
|
20
|
-
# @return [Array, DocumentStyle] array of document styles in current document
|
21
|
-
attr_accessor :document_styles
|
22
23
|
# @return [Numbering] store numbering data
|
23
24
|
attr_accessor :numbering
|
24
25
|
# @return [Styles] styles of document
|
25
26
|
attr_accessor :styles
|
26
|
-
attr_accessor :
|
27
|
+
attr_accessor :theme
|
28
|
+
# @return [Relationships] relationships
|
29
|
+
attr_accessor :relationships
|
27
30
|
# @return [DocumentSettings] settings
|
28
31
|
attr_accessor :settings
|
32
|
+
# @return [CommentsDocument] comments of whole document
|
33
|
+
attr_accessor :comments_document
|
29
34
|
# @return [CommentsExtended] extended comments
|
30
35
|
attr_accessor :comments_extended
|
31
36
|
|
@@ -34,9 +39,11 @@ module OoxmlParser
|
|
34
39
|
@notes = []
|
35
40
|
@document_properties = DocumentProperties.new
|
36
41
|
@comments = []
|
37
|
-
|
42
|
+
super
|
38
43
|
end
|
39
44
|
|
45
|
+
alias theme_colors theme
|
46
|
+
|
40
47
|
def ==(other)
|
41
48
|
@elements == other.elements &&
|
42
49
|
@page_properties == other.page_properties &&
|
@@ -46,10 +53,6 @@ module OoxmlParser
|
|
46
53
|
@comments == other.comments
|
47
54
|
end
|
48
55
|
|
49
|
-
def difference(other)
|
50
|
-
Hash.object_to_hash(self).diff(Hash.object_to_hash(other))
|
51
|
-
end
|
52
|
-
|
53
56
|
def element_by_description(location: :canvas, type: :docx_paragraph)
|
54
57
|
case location
|
55
58
|
when :canvas
|
@@ -66,7 +69,7 @@ module OoxmlParser
|
|
66
69
|
when :footer
|
67
70
|
case type
|
68
71
|
when :table
|
69
|
-
note_by_description(:footer1).elements[
|
72
|
+
note_by_description(:footer1).elements[0].rows[0].cells[0].elements
|
70
73
|
when :docx_paragraph, :simple, :paragraph
|
71
74
|
note_by_description(:footer1).elements
|
72
75
|
when :shape
|
@@ -77,7 +80,7 @@ module OoxmlParser
|
|
77
80
|
when :header
|
78
81
|
case type
|
79
82
|
when :table
|
80
|
-
note_by_description(:header1).elements[
|
83
|
+
note_by_description(:header1).elements[0].rows[0].cells[0].elements
|
81
84
|
when :docx_paragraph, :simple, :paragraph
|
82
85
|
note_by_description(:header1).elements
|
83
86
|
when :shape
|
@@ -116,34 +119,25 @@ module OoxmlParser
|
|
116
119
|
set
|
117
120
|
end
|
118
121
|
|
122
|
+
# @return [Array<DocumentStyle>] style of documents
|
123
|
+
def document_styles
|
124
|
+
styles.styles
|
125
|
+
end
|
126
|
+
|
119
127
|
def self.parse
|
120
128
|
doc_structure = DocumentStructure.new
|
129
|
+
doc_structure.content_types = ContentTypes.new(parent: doc_structure).parse
|
121
130
|
OOXMLDocumentObject.root_subfolder = 'word/'
|
122
131
|
OOXMLDocumentObject.xmls_stack = []
|
123
132
|
@comments = []
|
124
133
|
DocumentStructure.default_paragraph_style = DocxParagraph.new
|
125
|
-
DocumentStructure.default_run_style = DocxParagraphRun.new
|
126
|
-
doc_structure.
|
127
|
-
OOXMLDocumentObject.
|
128
|
-
|
129
|
-
# TODO: Remove this old way parsing in favor of doc_structure.styles.document_defaults
|
130
|
-
doc.search('//w:docDefaults').each do |doc_defaults|
|
131
|
-
doc_defaults.xpath('w:pPrDefault').each do |p_pr_defaults|
|
132
|
-
DocumentStructure.default_paragraph_style = DocxParagraph.new.parse(p_pr_defaults, 0)
|
133
|
-
end
|
134
|
-
doc_defaults.xpath('w:rPrDefault').each do |r_pr_defaults|
|
135
|
-
r_pr_defaults.xpath('w:rPr').each do |r_pr|
|
136
|
-
DocumentStructure.default_run_style = DocxParagraphRun.new.parse_properties(r_pr)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
parse_default_style
|
141
|
-
doc_structure.numbering = Numbering.new(parent: doc_structure).parse
|
142
|
-
doc_structure.document_styles = DocumentStyle.parse_list(doc_structure)
|
143
|
-
doc_structure.styles = Styles.new(parent: doc_structure).parse
|
134
|
+
DocumentStructure.default_run_style = DocxParagraphRun.new(parent: doc_structure)
|
135
|
+
doc_structure.theme = PresentationTheme.parse('word/theme/theme1.xml')
|
136
|
+
doc_structure.relationships = Relationships.new(parent: self).parse_file("#{OOXMLDocumentObject.path_to_folder}word/_rels/document.xml.rels")
|
137
|
+
doc_structure.parse_styles
|
144
138
|
number = 0
|
145
139
|
OOXMLDocumentObject.add_to_xmls_stack('word/document.xml')
|
146
|
-
doc =
|
140
|
+
doc = doc_structure.parse_xml(OOXMLDocumentObject.current_xml)
|
147
141
|
doc.search('//w:document').each do |document|
|
148
142
|
document.xpath('w:background').each do |background|
|
149
143
|
doc_structure.background = DocumentBackground.new(parent: doc_structure).parse(background)
|
@@ -165,7 +159,7 @@ module OoxmlParser
|
|
165
159
|
number += 1
|
166
160
|
doc_structure.elements << table
|
167
161
|
when 'sdt'
|
168
|
-
doc_structure.elements << StructuredDocumentTag.new(parent:
|
162
|
+
doc_structure.elements << StructuredDocumentTag.new(parent: doc_structure).parse(element)
|
169
163
|
end
|
170
164
|
end
|
171
165
|
body.xpath('w:sectPr').each do |sect_pr|
|
@@ -178,24 +172,34 @@ module OoxmlParser
|
|
178
172
|
end
|
179
173
|
OOXMLDocumentObject.xmls_stack.pop
|
180
174
|
doc_structure.document_properties = DocumentProperties.new(parent: doc_structure).parse
|
181
|
-
doc_structure.comments =
|
175
|
+
doc_structure.comments = Comments.new(parent: doc_structure).parse
|
182
176
|
doc_structure.comments_extended = CommentsExtended.new(parent: doc_structure).parse
|
177
|
+
doc_structure.comments_document = Comments.new(parent: doc_structure,
|
178
|
+
file: "#{OOXMLDocumentObject.path_to_folder}word/#{doc_structure.relationships.target_by_type('commentsDocument').first}")
|
179
|
+
.parse
|
183
180
|
doc_structure.settings = DocumentSettings.new(parent: doc_structure).parse
|
184
181
|
doc_structure
|
185
182
|
end
|
186
183
|
|
187
|
-
def
|
188
|
-
doc =
|
184
|
+
def parse_default_style
|
185
|
+
doc = parse_xml(OOXMLDocumentObject.path_to_folder + 'word/styles.xml')
|
189
186
|
doc.search('//w:style').each do |style|
|
190
187
|
next if style.attribute('default').nil?
|
191
|
-
|
188
|
+
|
189
|
+
if (style.attribute('default').value == '1' ||
|
190
|
+
style.attribute('default').value == 'on' ||
|
191
|
+
style.attribute('default').value == 'true') &&
|
192
|
+
style.attribute('type').value == 'paragraph'
|
192
193
|
style.xpath('w:pPr').each do |paragraph_pr_tag|
|
193
194
|
DocumentStructure.default_paragraph_style = DocxParagraph.new.parse_paragraph_style(paragraph_pr_tag, DocumentStructure.default_run_style)
|
194
195
|
end
|
195
196
|
style.xpath('w:rPr').each do |character_pr_tag|
|
196
197
|
DocumentStructure.default_run_style.parse_properties(character_pr_tag, DocumentStructure.default_run_style)
|
197
198
|
end
|
198
|
-
elsif (style.attribute('default').value == '1' ||
|
199
|
+
elsif (style.attribute('default').value == '1' ||
|
200
|
+
style.attribute('default').value == 'on' ||
|
201
|
+
style.attribute('default').value == 'true') &&
|
202
|
+
style.attribute('type').value == 'character'
|
199
203
|
style.xpath('w:rPr').each do |character_pr_tag|
|
200
204
|
DocumentStructure.default_run_style.parse_properties(character_pr_tag, DocumentStructure.default_run_style)
|
201
205
|
end
|
@@ -206,13 +210,44 @@ module OoxmlParser
|
|
206
210
|
DocumentStructure.default_table_run_style = DocumentStructure.default_run_style.dup
|
207
211
|
doc.search('//w:style').each do |style|
|
208
212
|
next if style.attribute('default').nil?
|
209
|
-
next unless (style.attribute('default').value == '1' ||
|
213
|
+
next unless (style.attribute('default').value == '1' ||
|
214
|
+
style.attribute('default').value == 'on' ||
|
215
|
+
style.attribute('default').value == 'true') &&
|
216
|
+
style.attribute('type').value == 'table'
|
217
|
+
|
210
218
|
style.xpath('w:rPr').each do |table_character_pr_tag|
|
211
219
|
DocumentStructure.default_table_run_style.parse_properties(table_character_pr_tag, DocumentStructure.default_run_style)
|
212
220
|
end
|
213
221
|
end
|
214
222
|
end
|
215
223
|
|
224
|
+
# Perform parsing styles.xml
|
225
|
+
def parse_styles
|
226
|
+
file = "#{OOXMLDocumentObject.path_to_folder}/word/styles.xml"
|
227
|
+
DocumentStructure.default_paragraph_style = DocxParagraph.new(parent: self)
|
228
|
+
DocumentStructure.default_table_paragraph_style = DocxParagraph.new(parent: self)
|
229
|
+
DocumentStructure.default_run_style = DocxParagraphRun.new(parent: self)
|
230
|
+
DocumentStructure.default_table_run_style = DocxParagraphRun.new(parent: self)
|
231
|
+
|
232
|
+
return unless File.exist?(file)
|
233
|
+
|
234
|
+
doc = parse_xml(file)
|
235
|
+
# TODO: Remove this old way parsing in favor of doc_structure.styles.document_defaults
|
236
|
+
doc.search('//w:docDefaults').each do |doc_defaults|
|
237
|
+
doc_defaults.xpath('w:pPrDefault').each do |p_pr_defaults|
|
238
|
+
DocumentStructure.default_paragraph_style = DocxParagraph.new(parent: self).parse(p_pr_defaults, 0)
|
239
|
+
end
|
240
|
+
doc_defaults.xpath('w:rPrDefault').each do |r_pr_defaults|
|
241
|
+
r_pr_defaults.xpath('w:rPr').each do |r_pr|
|
242
|
+
DocumentStructure.default_run_style = DocxParagraphRun.new(parent: self).parse_properties(r_pr)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
parse_default_style
|
247
|
+
@numbering = Numbering.new(parent: self).parse
|
248
|
+
@styles = Styles.new(parent: self).parse
|
249
|
+
end
|
250
|
+
|
216
251
|
class << self
|
217
252
|
attr_accessor :default_table_run_style
|
218
253
|
attr_accessor :default_table_paragraph_style
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'comments/comment'
|
4
|
+
module OoxmlParser
|
5
|
+
# Class for parsing `comments.xml` file
|
6
|
+
class Comments < OOXMLDocumentObject
|
7
|
+
# @return [Array<Comment>] list of comments
|
8
|
+
attr_reader :comments_array
|
9
|
+
|
10
|
+
def initialize(params = {})
|
11
|
+
@comments_array = []
|
12
|
+
@parent = params[:parent]
|
13
|
+
@file = params.fetch(:file, OOXMLDocumentObject.path_to_folder + 'word/comments.xml')
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Comment] accessor
|
17
|
+
def [](key)
|
18
|
+
@comments_array[key]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Parse CommentsExtended object
|
22
|
+
# @return [Comments] result of parsing
|
23
|
+
def parse
|
24
|
+
return nil unless File.file?(@file)
|
25
|
+
|
26
|
+
doc = parse_xml(@file)
|
27
|
+
doc.xpath('w:comments/*').each do |node_child|
|
28
|
+
case node_child.name
|
29
|
+
when 'comment'
|
30
|
+
@comments_array << Comment.new(parent: self).parse(node_child)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
self
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Comment Data
|
5
|
+
class Comment < OOXMLDocumentObject
|
6
|
+
# @return [Integer] id of comment
|
7
|
+
attr_reader :id
|
8
|
+
# @return [Array<DocxParagraph>] array of paragraphs
|
9
|
+
attr_reader :paragraphs
|
10
|
+
|
11
|
+
def initialize(id = nil, paragraphs = [], parent: nil)
|
12
|
+
@id = id
|
13
|
+
@paragraphs = paragraphs
|
14
|
+
@parent = parent
|
15
|
+
end
|
16
|
+
|
17
|
+
def parse(node)
|
18
|
+
node.attributes.each do |key, value|
|
19
|
+
case key
|
20
|
+
when 'id'
|
21
|
+
@id = value.value.to_i
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
node.xpath('*').each do |node_child|
|
26
|
+
case node_child.name
|
27
|
+
when 'p'
|
28
|
+
@paragraphs << DocxParagraph.new.parse(node_child, 0, parent: self)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
self
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'comments_extended/comment_extended'
|
2
4
|
module OoxmlParser
|
3
5
|
# Class for parsing `commentsExtended.xml` file
|
@@ -17,7 +19,8 @@ module OoxmlParser
|
|
17
19
|
def parse
|
18
20
|
file_to_parse = OOXMLDocumentObject.path_to_folder + 'word/commentsExtended.xml'
|
19
21
|
return nil unless File.exist?(file_to_parse)
|
20
|
-
|
22
|
+
|
23
|
+
doc = parse_xml(file_to_parse)
|
21
24
|
doc.xpath('w15:commentsEx/*').each do |node_child|
|
22
25
|
case node_child.name
|
23
26
|
when 'commentEx'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OoxmlParser
|
2
4
|
# Document Properties
|
3
5
|
class DocumentProperties < OOXMLDocumentObject
|
@@ -11,7 +13,7 @@ module OoxmlParser
|
|
11
13
|
warn "There is no 'docProps/app.xml' in docx. It may be some problem with it"
|
12
14
|
return self
|
13
15
|
end
|
14
|
-
node =
|
16
|
+
node = parse_xml(properties_file)
|
15
17
|
node.xpath('*').each do |node_child|
|
16
18
|
case node_child.name
|
17
19
|
when 'Properties'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OoxmlParser
|
2
4
|
# Class for parsing `settings.xml` file
|
3
5
|
class DocumentSettings < OOXMLDocumentObject
|
@@ -7,7 +9,10 @@ module OoxmlParser
|
|
7
9
|
# Parse Settings object
|
8
10
|
# @return [DocumentSettings] result of parsing
|
9
11
|
def parse
|
10
|
-
|
12
|
+
settings_path = OOXMLDocumentObject.path_to_folder + 'word/settings.xml'
|
13
|
+
return nil unless File.exist?(settings_path)
|
14
|
+
|
15
|
+
doc = parse_xml(settings_path)
|
11
16
|
doc.xpath('w:settings/*').each do |node_child|
|
12
17
|
case node_child.name
|
13
18
|
when 'defaultTabStop'
|
data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OoxmlParser
|
2
4
|
# method to help to work with DocumentStructure
|
3
5
|
module DocumentStructureHelpers
|
4
6
|
# @return [True, false] if structure contain any user data
|
5
7
|
def with_data?
|
6
|
-
return true if @elements.length > 1
|
7
8
|
@elements.each do |current_element|
|
8
9
|
return true if current_element.with_data?
|
9
10
|
end
|
@@ -1,9 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'document_style/document_style_helper'
|
2
4
|
module OoxmlParser
|
3
5
|
# Class for describing styles containing in +styles.xml+
|
4
6
|
class DocumentStyle < OOXMLDocumentObject
|
5
7
|
include TableStylePropertiesHelper
|
6
8
|
include DocumentStyleHelper
|
9
|
+
|
10
|
+
# @return [True, False] is style default
|
11
|
+
attr_reader :default
|
7
12
|
# @return [Symbol] Type of style (+:paragraph+ or +:table+)
|
8
13
|
attr_accessor :type
|
9
14
|
# @return [FixNum] number of style
|
@@ -30,6 +35,7 @@ module OoxmlParser
|
|
30
35
|
# Used to determine if current style is visible in style list in editors
|
31
36
|
# According to http://www.wordarticles.com/Articles/WordStyles/LatentStyles.php
|
32
37
|
attr_accessor :q_format
|
38
|
+
|
33
39
|
alias visible? q_format
|
34
40
|
|
35
41
|
def initialize(parent: nil)
|
@@ -55,6 +61,8 @@ module OoxmlParser
|
|
55
61
|
@type = value.value.to_sym
|
56
62
|
when 'styleId'
|
57
63
|
@style_id = value.value
|
64
|
+
when 'default'
|
65
|
+
@default = attribute_enabled?(value.value)
|
58
66
|
end
|
59
67
|
end
|
60
68
|
node.xpath('*').each do |subnode|
|
@@ -66,7 +74,7 @@ module OoxmlParser
|
|
66
74
|
when 'next'
|
67
75
|
@next_style = subnode.attribute('val').value
|
68
76
|
when 'rPr'
|
69
|
-
@run_properties = DocxParagraphRun.new.parse_properties(subnode)
|
77
|
+
@run_properties = DocxParagraphRun.new(parent: self).parse_properties(subnode)
|
70
78
|
when 'pPr'
|
71
79
|
@paragraph_properties = ParagraphProperties.new(parent: self).parse(subnode)
|
72
80
|
when 'tblPr'
|
@@ -84,16 +92,5 @@ module OoxmlParser
|
|
84
92
|
fill_empty_table_styles
|
85
93
|
self
|
86
94
|
end
|
87
|
-
|
88
|
-
# Parse all document style list
|
89
|
-
# @return [Array, DocumentStyle]
|
90
|
-
def self.parse_list(parent)
|
91
|
-
styles_array = []
|
92
|
-
doc = Nokogiri::XML(File.open(OOXMLDocumentObject.path_to_folder + 'word/styles.xml'))
|
93
|
-
doc.search('//w:style').each do |style|
|
94
|
-
styles_array << DocumentStyle.new(parent: parent).parse(style)
|
95
|
-
end
|
96
|
-
styles_array
|
97
|
-
end
|
98
95
|
end
|
99
96
|
end
|
@@ -1,7 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# noinspection RubyTooManyInstanceVariablesInspection
|
2
|
-
require_relative 'docx_paragraph/
|
4
|
+
require_relative 'docx_paragraph/bookmark_start'
|
5
|
+
require_relative 'docx_paragraph/bookmark_end'
|
6
|
+
require_relative 'docx_paragraph/comment_range_end'
|
7
|
+
require_relative 'docx_paragraph/comment_range_start'
|
3
8
|
require_relative 'docx_paragraph/docx_paragraph_helper'
|
4
9
|
require_relative 'docx_paragraph/docx_paragraph_run'
|
10
|
+
require_relative 'docx_paragraph/field_simple'
|
5
11
|
require_relative 'docx_paragraph/indents'
|
6
12
|
require_relative 'docx_paragraph/inserted'
|
7
13
|
require_relative 'docx_paragraph/structured_document_tag'
|
@@ -9,24 +15,27 @@ require_relative 'docx_paragraph/frame_properties'
|
|
9
15
|
require_relative 'docx_paragraph/docx_formula'
|
10
16
|
require_relative 'docx_paragraph/style_parametres'
|
11
17
|
module OoxmlParser
|
18
|
+
# Class for data of DocxParagraph
|
12
19
|
class DocxParagraph < OOXMLDocumentObject
|
13
20
|
include DocxParagraphHelper
|
14
21
|
attr_accessor :number, :bookmark_start, :bookmark_end, :align, :spacing, :background_color, :ind, :numbering,
|
15
|
-
:character_style_array, :
|
22
|
+
:character_style_array, :page_break, :borders, :keep_lines,
|
16
23
|
:contextual_spacing, :sector_properties, :page_numbering, :section_break, :style, :keep_next,
|
17
|
-
:orphan_control
|
24
|
+
:orphan_control
|
18
25
|
# @return [Hyperlink] hyperlink in paragraph
|
19
26
|
attr_reader :hyperlink
|
20
27
|
# @return [ParagraphProperties] Properties of current paragraph
|
21
28
|
attr_accessor :paragraph_properties
|
22
29
|
# @return [Inserted] data inserted by review
|
23
30
|
attr_accessor :inserted
|
31
|
+
# @return [FieldSimple] field simple
|
32
|
+
attr_reader :field_simple
|
24
33
|
# @return [Integer] id of paragraph (for comment)
|
25
34
|
attr_accessor :paragraph_id
|
35
|
+
# @return [MathParagraph] math paragraph
|
36
|
+
attr_reader :math_paragraph
|
26
37
|
# @return [Integer] id of text (for comment)
|
27
38
|
attr_accessor :text_id
|
28
|
-
# @return [StructuredDocumentTag] structured document tag data
|
29
|
-
attr_accessor :sdt
|
30
39
|
|
31
40
|
def initialize(parent: nil)
|
32
41
|
@number = 0
|
@@ -35,9 +44,7 @@ module OoxmlParser
|
|
35
44
|
@align = 'left'
|
36
45
|
@spacing = Spacing.new
|
37
46
|
@ind = Indents.new
|
38
|
-
@kinoku = false
|
39
47
|
@character_style_array = []
|
40
|
-
@horizontal_line = false
|
41
48
|
@page_break = false
|
42
49
|
@borders = Borders.new
|
43
50
|
@keep_lines = false
|
@@ -48,6 +55,8 @@ module OoxmlParser
|
|
48
55
|
@parent = parent
|
49
56
|
end
|
50
57
|
|
58
|
+
alias elements character_style_array
|
59
|
+
|
51
60
|
def initialize_copy(source)
|
52
61
|
super
|
53
62
|
@bookmark_start = source.bookmark_start.clone
|
@@ -58,16 +67,14 @@ module OoxmlParser
|
|
58
67
|
|
59
68
|
def nonempty_runs
|
60
69
|
@character_style_array.select do |cur_run|
|
61
|
-
if cur_run.is_a?(DocxParagraphRun)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
)
|
70
|
-
elsif cur_run.is_a?(DocxFormula)
|
70
|
+
if cur_run.is_a?(DocxParagraphRun) || cur_run.is_a?(ParagraphRun)
|
71
|
+
!cur_run.empty?
|
72
|
+
elsif cur_run.is_a?(DocxFormula) ||
|
73
|
+
cur_run.is_a?(StructuredDocumentTag) ||
|
74
|
+
cur_run.is_a?(BookmarkStart) ||
|
75
|
+
cur_run.is_a?(BookmarkEnd) ||
|
76
|
+
cur_run.is_a?(CommentRangeStart) ||
|
77
|
+
cur_run.is_a?(CommentRangeEnd)
|
71
78
|
true
|
72
79
|
end
|
73
80
|
end
|
@@ -77,14 +84,7 @@ module OoxmlParser
|
|
77
84
|
|
78
85
|
# @return [True, false] if structure contain any user data
|
79
86
|
def with_data?
|
80
|
-
!nonempty_runs.empty?
|
81
|
-
end
|
82
|
-
|
83
|
-
def remove_empty_runs
|
84
|
-
nonempty = nonempty_runs
|
85
|
-
@character_style_array.each do |cur_run|
|
86
|
-
@character_style_array.delete(cur_run) unless nonempty.include?(cur_run)
|
87
|
-
end
|
87
|
+
!nonempty_runs.empty? || paragraph_properties.section_properties
|
88
88
|
end
|
89
89
|
|
90
90
|
def ==(other)
|
@@ -98,10 +98,11 @@ module OoxmlParser
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def parse(node, par_number = 0, default_character = DocxParagraphRun.new, parent: nil)
|
101
|
-
@parent
|
101
|
+
@parent ||= parent
|
102
102
|
default_character_style = default_character.dup
|
103
103
|
character_styles_array = []
|
104
104
|
custom_character_style = default_character_style.dup
|
105
|
+
custom_character_style.parent = self
|
105
106
|
char_number = 0
|
106
107
|
comments = []
|
107
108
|
node.attributes.each do |key, value|
|
@@ -115,30 +116,20 @@ module OoxmlParser
|
|
115
116
|
node.xpath('*').each do |node_child|
|
116
117
|
case node_child.name
|
117
118
|
when 'bookmarkStart'
|
118
|
-
|
119
|
+
character_styles_array << BookmarkStart.new(parent: self).parse(node_child)
|
119
120
|
when 'bookmarkEnd'
|
120
|
-
|
121
|
+
character_styles_array << BookmarkEnd.new(parent: self).parse(node_child)
|
121
122
|
when 'pPr'
|
122
123
|
parse_paragraph_style(node_child, custom_character_style)
|
123
|
-
node.xpath('w:pict').each do |pict|
|
124
|
-
pict.xpath('v:rect').each do
|
125
|
-
@horizontal_line = true
|
126
|
-
end
|
127
|
-
end
|
128
124
|
@paragraph_properties = ParagraphProperties.new(parent: self).parse(node_child)
|
129
125
|
when 'commentRangeStart'
|
130
|
-
|
126
|
+
character_styles_array << CommentRangeStart.new(parent: self).parse(node_child)
|
127
|
+
when 'commentRangeEnd'
|
128
|
+
character_styles_array << CommentRangeEnd.new(parent: self).parse(node_child)
|
131
129
|
when 'fldSimple'
|
132
|
-
|
133
|
-
@page_numbering = true if
|
134
|
-
|
135
|
-
character_style = default_character_style.dup
|
136
|
-
character_style.parse(r_tag, char_number, parent: parent)
|
137
|
-
character_style.page_number = @page_numbering
|
138
|
-
character_style.instruction = instruction
|
139
|
-
character_styles_array << character_style.dup
|
140
|
-
char_number += 1
|
141
|
-
end
|
130
|
+
@field_simple = FieldSimple.new(parent: self).parse(node_child)
|
131
|
+
@page_numbering = true if field_simple.page_numbering?
|
132
|
+
character_styles_array += field_simple.runs
|
142
133
|
when 'r'
|
143
134
|
character_style = custom_character_style.dup
|
144
135
|
node_child.xpath('w:instrText').each do |insrt_text|
|
@@ -147,47 +138,33 @@ module OoxmlParser
|
|
147
138
|
character_style.parse(node_child, char_number, parent: self)
|
148
139
|
character_style.comments = comments.dup
|
149
140
|
character_styles_array << character_style.dup
|
150
|
-
character_styles_array.last.shape = character_style.shape
|
141
|
+
character_styles_array.last.shape = character_style.shape if character_style.shape
|
151
142
|
char_number += 1
|
152
143
|
when 'hyperlink'
|
153
144
|
@hyperlink = Hyperlink.new(parent: self).parse(node_child)
|
154
145
|
character_style = default_character_style.dup
|
155
|
-
|
146
|
+
character_style.parent = self
|
147
|
+
if node_child.attribute('id')
|
156
148
|
character_style.link = Hyperlink.new(parent: character_style).parse(node_child)
|
157
|
-
|
158
|
-
character_style.link = node_child.attribute('anchor').value
|
149
|
+
elsif node_child.attribute('anchor')
|
150
|
+
character_style.link = node_child.attribute('anchor').value
|
159
151
|
end
|
160
152
|
node_child.xpath('w:r').each do |r_tag|
|
161
|
-
character_style.parse(r_tag, char_number, parent:
|
153
|
+
character_style.parse(r_tag, char_number, parent: self)
|
162
154
|
character_styles_array << character_style.dup
|
163
155
|
char_number += 1
|
164
156
|
end
|
165
157
|
node_child.xpath('w:fldSimple').each do |simple_field|
|
166
|
-
|
167
|
-
|
168
|
-
simple_field.xpath('w:r').each do |r_tag|
|
169
|
-
character_style.parse(r_tag, char_number, parent: self)
|
170
|
-
character_style.page_number = @page_numbering
|
171
|
-
character_style.instruction = instruction
|
172
|
-
character_styles_array << character_style.dup
|
173
|
-
char_number += 1
|
174
|
-
end
|
158
|
+
hyperlink_field_simple = FieldSimple.new(parent: self).parse(simple_field)
|
159
|
+
character_styles_array += hyperlink_field_simple.runs
|
175
160
|
end
|
176
161
|
when 'oMathPara'
|
177
|
-
|
178
|
-
|
179
|
-
end
|
180
|
-
when 'commentRangeEnd'
|
181
|
-
comments.each_with_index do |comment, index|
|
182
|
-
if comment == node_child.attribute('id').value
|
183
|
-
comments.delete_at(index)
|
184
|
-
break
|
185
|
-
end
|
186
|
-
end
|
162
|
+
@math_paragraph = MathParagraph.new(parent: self).parse(node_child)
|
163
|
+
character_styles_array << math_paragraph.math
|
187
164
|
when 'ins'
|
188
165
|
@inserted = Inserted.new(parent: self).parse(node_child)
|
189
166
|
when 'sdt'
|
190
|
-
|
167
|
+
character_styles_array << StructuredDocumentTag.new(parent: self).parse(node_child)
|
191
168
|
end
|
192
169
|
end
|
193
170
|
@number = par_number
|
@@ -197,7 +174,7 @@ module OoxmlParser
|
|
197
174
|
self
|
198
175
|
end
|
199
176
|
|
200
|
-
def parse_paragraph_style(node, default_char_style = DocxParagraphRun.new)
|
177
|
+
def parse_paragraph_style(node, default_char_style = DocxParagraphRun.new(parent: self))
|
201
178
|
node.xpath('*').each do |node_child|
|
202
179
|
case node_child.name
|
203
180
|
when 'pageBreakBefore'
|
@@ -221,13 +198,9 @@ module OoxmlParser
|
|
221
198
|
@background_color = Color.new(parent: self).parse_hex_string(background_color_string)
|
222
199
|
@background_color.set_style(node_child.attribute('val').value.to_sym) unless node_child.attribute('val').nil?
|
223
200
|
when 'pStyle'
|
224
|
-
|
201
|
+
parse_paragraph_style_xml(node_child.attribute('val').value, default_char_style)
|
225
202
|
when 'ind'
|
226
203
|
@ind = DocumentStructure.default_paragraph_style.ind.dup.parse(node_child)
|
227
|
-
when 'kinoku'
|
228
|
-
@kinoku = true
|
229
|
-
when 'framePr'
|
230
|
-
@frame_properties = FrameProperties.new(parent: self).parse(node_child)
|
231
204
|
when 'numPr'
|
232
205
|
@numbering = NumberingProperties.new(parent: self).parse(node_child)
|
233
206
|
when 'jc'
|
@@ -245,8 +218,6 @@ module OoxmlParser
|
|
245
218
|
@section_break = case @sector_properties.type
|
246
219
|
when 'oddPage'
|
247
220
|
'Odd page'
|
248
|
-
when 'evenPage'
|
249
|
-
'Even page'
|
250
221
|
when 'continuous'
|
251
222
|
'Current Page'
|
252
223
|
else
|
@@ -258,13 +229,14 @@ module OoxmlParser
|
|
258
229
|
self
|
259
230
|
end
|
260
231
|
|
261
|
-
def
|
262
|
-
doc =
|
232
|
+
def parse_paragraph_style_xml(id, character_style)
|
233
|
+
doc = parse_xml(OOXMLDocumentObject.path_to_folder + 'word/styles.xml')
|
263
234
|
doc.search('//w:style').each do |style|
|
264
235
|
next unless style.attribute('styleId').value == id
|
236
|
+
|
265
237
|
style.xpath('w:pPr').each do |p_pr|
|
266
|
-
|
267
|
-
|
238
|
+
parse_paragraph_style(p_pr, character_style)
|
239
|
+
@style = StyleParametres.new(parent: self).parse(style)
|
268
240
|
end
|
269
241
|
style.xpath('w:rPr').each do |r_pr|
|
270
242
|
character_style.parse_properties(r_pr, DocumentStructure.default_run_style)
|
@@ -272,5 +244,23 @@ module OoxmlParser
|
|
272
244
|
break
|
273
245
|
end
|
274
246
|
end
|
247
|
+
|
248
|
+
extend Gem::Deprecate
|
249
|
+
deprecate :page_numbering, 'field_simple.page_numbering?', 2020, 1
|
250
|
+
|
251
|
+
# @return [OoxmlParser::StructuredDocumentTag] Return first sdt element
|
252
|
+
def sdt
|
253
|
+
@character_style_array.each do |cur_element|
|
254
|
+
return cur_element if cur_element.is_a?(StructuredDocumentTag)
|
255
|
+
end
|
256
|
+
nil
|
257
|
+
end
|
258
|
+
deprecate :sdt, 'nonempty_runs[i]', 2020, 1
|
259
|
+
|
260
|
+
# @return [OoxmlParser::FrameProperties] Return frame properties
|
261
|
+
def frame_properties
|
262
|
+
paragraph_properties.frame_properties
|
263
|
+
end
|
264
|
+
deprecate :frame_properties, 'paragraph_properties.frame_properties', 2020, 1
|
275
265
|
end
|
276
266
|
end
|