ooxml_parser 0.14.1-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/chart_style.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +21 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +42 -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/pivot_formats.rb +33 -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/plot_area.rb +67 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/number_string_reference.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/number_string_cache.rb +36 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point/text_value.rb +17 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point.rb +38 -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/x_y_values.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +52 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/view_3d.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +174 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis/scaling.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +48 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +39 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_point.rb +13 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +43 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing/doc_properties.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +46 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +63 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +44 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +46 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +116 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb +19 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_horizontal.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_vertical.rb +32 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +37 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +43 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +31 -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 +40 -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 +23 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb +25 -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/shape_style/effect_reference.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +28 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +49 -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 +21 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +49 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +43 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +24 -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 +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 +34 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +63 -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 +21 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill.rb +26 -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 +26 -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 +33 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +59 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +52 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_element.rb +12 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_properties.rb +8 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +28 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +32 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +73 -0
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +59 -0
- data/lib/ooxml_parser/common_parser/common_data/color/color_indexes.list +66 -0
- data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +66 -0
- data/lib/ooxml_parser/common_parser/common_data/color.rb +308 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb +17 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +67 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +36 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +41 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +19 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_default.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_override.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types.rb +45 -0
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +155 -0
- data/lib/ooxml_parser/common_parser/common_data/font_style.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +89 -0
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +117 -0
- 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/ooxml_document_object.rb +144 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +109 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +60 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +148 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/text.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +63 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +41 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +57 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_stlye_ref.rb +27 -0
- 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/spacing.rb +100 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/tab.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +46 -0
- data/lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/relationships.rb +68 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +54 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_layout.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +48 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +50 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +61 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +45 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +57 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_row_band_size.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +52 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +89 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +96 -0
- 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 +43 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties/table_row_height.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +40 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid/grid_column.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties/table_borders.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +104 -0
- data/lib/ooxml_parser/common_parser/common_data/table.rb +52 -0
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +50 -0
- data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_document_structure.rb +25 -0
- data/lib/ooxml_parser/common_parser/parser.rb +49 -0
- data/lib/ooxml_parser/configuration.rb +13 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +37 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments.rb +36 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended/comment_extended.rb +26 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended.rb +42 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +35 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +33 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +25 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb +19 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb +39 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +98 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_end.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_start.rb +26 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_end.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_start.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties/argument_size.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties.rb +23 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +32 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +35 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +23 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +31 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +24 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +28 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +13 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +45 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_grow.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_limit_location.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties.rb +28 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary.rb +33 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +32 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +75 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_helper.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +111 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb +25 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object.rb +23 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_margins.rb +14 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_size.rb +13 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/stroke.rb +13 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties.rb +19 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +77 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +16 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +29 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +147 -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 +51 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +51 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb +57 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb +46 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_properties.rb +30 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/structured_document_tag.rb +28 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +30 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +273 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +63 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/multilevel_type.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_justification.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_text.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/numbering_format.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +33 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +66 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +44 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition.rb +32 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +56 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +23 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +56 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +25 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/footnote_properties.rb +34 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +52 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +45 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +83 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +62 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/paragraph_properties_default.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/run_properties_default.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb +28 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +32 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +290 -0
- data/lib/ooxml_parser/docx_parser/docx_parser.rb +19 -0
- data/lib/ooxml_parser/helpers/string_helper.rb +24 -0
- data/lib/ooxml_parser/name.rb +9 -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/comment_authors.rb +39 -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_comments.rb +33 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_helpers.rb +16 -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/font_scheme/font_collection.rb +31 -0
- 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/theme_color.rb +47 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +54 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties/stretch.rb +13 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties.rb +23 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +35 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb +35 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data.rb +28 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/connection_shape.rb +7 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +50 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +27 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_notes.rb +23 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +30 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +33 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +28 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +23 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/codition_list/condition.rb +23 -0
- 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/timing/time_node/common_timing.rb +44 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +59 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +29 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +68 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +25 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +36 -0
- 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/transition/transition_properties/transition_properties.rb +30 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +85 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +25 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/table_styles.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +62 -0
- data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +17 -0
- data/lib/ooxml_parser/version.rb +9 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/defined_name.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field/shared_items.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source/worksheet_source.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache.rb +41 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items/column_row_item.rb +22 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/location.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items/item.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_table_style_info.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition.rb +114 -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/shared_string_table.rb +46 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/cell_style/alignment.rb +35 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +150 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb +35 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +49 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +40 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +44 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +40 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats/number_format.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +44 -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/style_sheet/xlsx_borders.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +50 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb +14 -0
- 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 +31 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +44 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/ole_objects.rb +20 -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 +23 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +27 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +41 -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/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.rb +40 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter.rb +36 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation/data_validation_formula.rb +22 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb +88 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations.rb +47 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group.rb +115 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +32 -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_columns.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb +50 -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 +54 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb +27 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +40 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_header_footer/header_footer_child.rb +56 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_header_footer.rb +64 -0
- 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_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +84 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +152 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +165 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +17 -0
- data/lib/ooxml_parser.rb +40 -0
- metadata +572 -0
data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `docGrid` tags
|
5
|
+
class DocumentGrid < OOXMLDocumentObject
|
6
|
+
attr_accessor :type, :line_pitch, :char_space
|
7
|
+
|
8
|
+
# Parse DocumentGrid
|
9
|
+
# @param [Nokogiri::XML:Element] node with DocumentGrid
|
10
|
+
# @return [DocumentGrid] value of DocumentGrid
|
11
|
+
def parse(node)
|
12
|
+
node.attributes.each do |key, value|
|
13
|
+
case key
|
14
|
+
when 'charSpace'
|
15
|
+
@char_space = value.value
|
16
|
+
when 'linePitch'
|
17
|
+
@line_pitch = value.value.to_i
|
18
|
+
when 'type'
|
19
|
+
@type = value.value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
self
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `footnotePr` tags
|
5
|
+
class FootnoteProperties < OOXMLDocumentObject
|
6
|
+
# @return [NumberingFormat] format of numbering
|
7
|
+
attr_accessor :numbering_format
|
8
|
+
# @return [ValuedChild] type of numbering restart
|
9
|
+
attr_accessor :numbering_restart
|
10
|
+
# @return [ValuedChild] value of numbering start
|
11
|
+
attr_accessor :numbering_start
|
12
|
+
# @return [ValuedChild] position of footnote
|
13
|
+
attr_accessor :position
|
14
|
+
|
15
|
+
# Parse FootnoteProperties
|
16
|
+
# @param [Nokogiri::XML:Element] node with FootnoteProperties
|
17
|
+
# @return [FootnoteProperties] value of FootnoteProperties
|
18
|
+
def parse(node)
|
19
|
+
node.xpath('*').each do |node_child|
|
20
|
+
case node_child.name
|
21
|
+
when 'numFmt'
|
22
|
+
@numbering_format = ValuedChild.new(:symbol, parent: self).parse(node_child)
|
23
|
+
when 'numRestart'
|
24
|
+
@numbering_restart = ValuedChild.new(:symbol, parent: self).parse(node_child)
|
25
|
+
when 'numStart'
|
26
|
+
@numbering_start = ValuedChild.new(:integer, parent: self).parse(node_child)
|
27
|
+
when 'pos'
|
28
|
+
@position = ValuedChild.new(:symbol, parent: self).parse(node_child)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
self
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class with data of Note
|
5
|
+
class Note < OOXMLDocumentObject
|
6
|
+
attr_accessor :type, :elements, :assigned_to
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@elements = []
|
10
|
+
super(parent: nil)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Parse note data
|
14
|
+
# @param params [Hash] data to parse
|
15
|
+
# @return [Note] result of parsing
|
16
|
+
def self.parse(params)
|
17
|
+
note = Note.new
|
18
|
+
note.type = params[:type]
|
19
|
+
note.assigned_to = params[:assigned_to]
|
20
|
+
note.parent = params[:parent]
|
21
|
+
doc = note.parse_xml(note.file_path(params[:target]))
|
22
|
+
if note.type.include?('footer')
|
23
|
+
xpath_note = '//w:ftr'
|
24
|
+
elsif note.type.include?('header')
|
25
|
+
xpath_note = '//w:hdr'
|
26
|
+
end
|
27
|
+
doc.search(xpath_note).each do |ftr|
|
28
|
+
number = 0
|
29
|
+
ftr.xpath('*').each do |sub_element|
|
30
|
+
case sub_element.name
|
31
|
+
when 'p'
|
32
|
+
note.elements << params[:default_paragraph].dup.parse(sub_element, number, params[:default_character], parent: note)
|
33
|
+
number += 1
|
34
|
+
when 'tbl'
|
35
|
+
note.elements << Table.new(parent: note).parse(sub_element, number)
|
36
|
+
number += 1
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
note
|
41
|
+
end
|
42
|
+
|
43
|
+
# @param target [String] name of target
|
44
|
+
# @return [String] path to note xml file
|
45
|
+
def file_path(target)
|
46
|
+
file = "#{OOXMLDocumentObject.path_to_folder}word/#{target}"
|
47
|
+
return file if File.exist?(file)
|
48
|
+
|
49
|
+
"#{OOXMLDocumentObject.path_to_folder}#{target}" unless File.exist?(file)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `pgMar` tags
|
5
|
+
class PageMargins < OOXMLDocumentObject
|
6
|
+
attr_accessor :top, :bottom, :left, :right, :footer, :gutter, :header
|
7
|
+
|
8
|
+
def initialize(params)
|
9
|
+
@top = params[:top]
|
10
|
+
@bottom = params[:bottom]
|
11
|
+
@left = params[:left]
|
12
|
+
@right = params[:right]
|
13
|
+
@header = params[:header]
|
14
|
+
@footer = params[:footer]
|
15
|
+
@gutter = params[:gutter]
|
16
|
+
@parent = params[:parent]
|
17
|
+
super(parent: nil)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Parse BordersProperties
|
21
|
+
# @param [Nokogiri::XML:Element] node with PageMargins
|
22
|
+
# @return [PageMargins] value of PageMargins
|
23
|
+
def parse(node, unit = :dxa)
|
24
|
+
node.attributes.each do |key, value|
|
25
|
+
case key
|
26
|
+
when 'top'
|
27
|
+
@top = OoxmlSize.new(value.value.to_f, unit)
|
28
|
+
when 'left'
|
29
|
+
@left = OoxmlSize.new(value.value.to_f, unit)
|
30
|
+
when 'right'
|
31
|
+
@right = OoxmlSize.new(value.value.to_f, unit)
|
32
|
+
when 'bottom'
|
33
|
+
@bottom = OoxmlSize.new(value.value.to_f, unit)
|
34
|
+
when 'header'
|
35
|
+
@header = OoxmlSize.new(value.value.to_f, unit)
|
36
|
+
when 'footer'
|
37
|
+
@footer = OoxmlSize.new(value.value.to_f, unit)
|
38
|
+
when 'gutter'
|
39
|
+
@gutter = OoxmlSize.new(value.value.to_f, unit)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
self
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'document_grid'
|
4
|
+
require_relative 'footnote_properties'
|
5
|
+
require_relative 'page_size'
|
6
|
+
require_relative 'page_margins'
|
7
|
+
require_relative 'columns'
|
8
|
+
require_relative 'note'
|
9
|
+
module OoxmlParser
|
10
|
+
# Class for data of PageProperties
|
11
|
+
class PageProperties < OOXMLDocumentObject
|
12
|
+
attr_accessor :type, :size, :margins, :document_grid, :num_type, :form_prot, :text_direction, :page_borders, :columns,
|
13
|
+
:notes
|
14
|
+
# @return [FootnoteProperties] properties of footnote
|
15
|
+
attr_accessor :footnote_properties
|
16
|
+
# @return [True, False] Specifies whether the section should have a different header and footer for its first page
|
17
|
+
attr_reader :title_page
|
18
|
+
|
19
|
+
def initialize(parent: nil)
|
20
|
+
@notes = []
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
# Parse PageProperties data
|
25
|
+
# @param [Nokogiri::XML:Element] node with PageProperties data
|
26
|
+
# @return [PageProperties] value of PageProperties data
|
27
|
+
def parse(node, default_paragraph, default_character)
|
28
|
+
node.xpath('*').each do |pg_size_subnode|
|
29
|
+
case pg_size_subnode.name
|
30
|
+
when 'pgSz'
|
31
|
+
@size = PageSize.new.parse(pg_size_subnode)
|
32
|
+
when 'pgBorders'
|
33
|
+
page_borders = Borders.new
|
34
|
+
page_borders.display = pg_size_subnode.attribute('display').value.to_sym unless pg_size_subnode.attribute('display').nil?
|
35
|
+
page_borders.offset_from = pg_size_subnode.attribute('offsetFrom').value.to_sym unless pg_size_subnode.attribute('offsetFrom').nil?
|
36
|
+
pg_size_subnode.xpath('w:bottom').each do |bottom|
|
37
|
+
page_borders.bottom = BordersProperties.new(parent: page_borders).parse(bottom)
|
38
|
+
end
|
39
|
+
pg_size_subnode.xpath('w:left').each do |left|
|
40
|
+
page_borders.bottom = BordersProperties.new(parent: page_borders).parse(left)
|
41
|
+
end
|
42
|
+
pg_size_subnode.xpath('w:top').each do |top|
|
43
|
+
page_borders.bottom = BordersProperties.new(parent: page_borders).parse(top)
|
44
|
+
end
|
45
|
+
pg_size_subnode.xpath('w:right').each do |right|
|
46
|
+
page_borders.bottom = BordersProperties.new(parent: page_borders).parse(right)
|
47
|
+
end
|
48
|
+
@page_borders = page_borders
|
49
|
+
when 'type'
|
50
|
+
@type = pg_size_subnode.attribute('val').value
|
51
|
+
when 'pgMar'
|
52
|
+
@margins = PageMargins.new(parent: self).parse(pg_size_subnode)
|
53
|
+
when 'pgNumType'
|
54
|
+
@num_type = pg_size_subnode.attribute('fmt').value unless pg_size_subnode.attribute('fmt').nil?
|
55
|
+
when 'formProt'
|
56
|
+
@form_prot = pg_size_subnode.attribute('val').value
|
57
|
+
when 'textDirection'
|
58
|
+
@text_direction = pg_size_subnode.attribute('val').value
|
59
|
+
when 'docGrid'
|
60
|
+
@document_grid = DocumentGrid.new(parent: self).parse(pg_size_subnode)
|
61
|
+
when 'titlePg'
|
62
|
+
@title_page = option_enabled?(pg_size_subnode)
|
63
|
+
when 'cols'
|
64
|
+
@columns = Columns.new.parse(pg_size_subnode)
|
65
|
+
when 'headerReference', 'footerReference'
|
66
|
+
target = OOXMLDocumentObject.get_link_from_rels(pg_size_subnode.attribute('id').value)
|
67
|
+
OOXMLDocumentObject.add_to_xmls_stack("word/#{target}")
|
68
|
+
note = Note.parse(default_paragraph: default_paragraph,
|
69
|
+
default_character: default_character,
|
70
|
+
target: target,
|
71
|
+
assigned_to: pg_size_subnode.attribute('type').value,
|
72
|
+
type: File.basename(target).sub('.xml', ''),
|
73
|
+
parent: self)
|
74
|
+
@notes << note
|
75
|
+
OOXMLDocumentObject.xmls_stack.pop
|
76
|
+
when 'footnotePr'
|
77
|
+
@footnote_properties = FootnoteProperties.new(parent: self).parse(pg_size_subnode)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
self
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for data of PageSize
|
5
|
+
class PageSize < OOXMLDocumentObject
|
6
|
+
attr_accessor :height, :width, :orientation
|
7
|
+
|
8
|
+
def initialize(height = nil, width = nil, orientation = :portrait)
|
9
|
+
@height = height
|
10
|
+
@width = width
|
11
|
+
@orientation = orientation
|
12
|
+
super(parent: nil)
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [String] convert to string
|
16
|
+
def to_s
|
17
|
+
"Height: #{@height} Width: #{@width} Orientation: #{@orientation}"
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [True, False] compare dimensions of size, ignoring orientation
|
21
|
+
def same_dimensions?(other)
|
22
|
+
(@height == other.height) && (@width == other.width) ||
|
23
|
+
(@height == other.width) && (@width == other.height)
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [String] get human format name
|
27
|
+
def name
|
28
|
+
return 'US Letter' if same_dimensions?(PageSize.new(OoxmlSize.new(27.94, :centimeter), OoxmlSize.new(21.59, :centimeter)))
|
29
|
+
return 'US Legal' if same_dimensions?(PageSize.new(OoxmlSize.new(35.56, :centimeter), OoxmlSize.new(21.59, :centimeter)))
|
30
|
+
return 'A4' if same_dimensions?(PageSize.new(OoxmlSize.new(29.7, :centimeter), OoxmlSize.new(21.0, :centimeter)))
|
31
|
+
return 'A5' if same_dimensions?(PageSize.new(OoxmlSize.new(20.99, :centimeter), OoxmlSize.new(14.81, :centimeter)))
|
32
|
+
return 'B5' if same_dimensions?(PageSize.new(OoxmlSize.new(25.01, :centimeter), OoxmlSize.new(17.6, :centimeter)))
|
33
|
+
return 'Envelope #10' if same_dimensions?(PageSize.new(OoxmlSize.new(24.13, :centimeter), OoxmlSize.new(10.48, :centimeter)))
|
34
|
+
return 'Envelope DL' if same_dimensions?(PageSize.new(OoxmlSize.new(22.01, :centimeter), OoxmlSize.new(11.01, :centimeter)))
|
35
|
+
return 'Tabloid' if same_dimensions?(PageSize.new(OoxmlSize.new(43.17, :centimeter), OoxmlSize.new(27.94, :centimeter)))
|
36
|
+
return 'A3' if same_dimensions?(PageSize.new(OoxmlSize.new(42.01, :centimeter), OoxmlSize.new(29.7, :centimeter)))
|
37
|
+
return 'Tabloid Oversize' if same_dimensions?(PageSize.new(OoxmlSize.new(45.71, :centimeter), OoxmlSize.new(30.48, :centimeter)))
|
38
|
+
return 'ROC 16K' if same_dimensions?(PageSize.new(OoxmlSize.new(27.3, :centimeter), OoxmlSize.new(19.68, :centimeter)))
|
39
|
+
return 'Envelope Choukei 3' if same_dimensions?(PageSize.new(OoxmlSize.new(23.49, :centimeter), OoxmlSize.new(11.99, :centimeter)))
|
40
|
+
return 'Super B/A3' if same_dimensions?(PageSize.new(OoxmlSize.new(48.25, :centimeter), OoxmlSize.new(33.02, :centimeter)))
|
41
|
+
|
42
|
+
"Unknown page size: Height #{@height} Width #{@width}"
|
43
|
+
end
|
44
|
+
|
45
|
+
# Parse PageSize
|
46
|
+
# @param [Nokogiri::XML:Element] node with PageSize
|
47
|
+
# @return [PageSize] value of Size
|
48
|
+
def parse(node)
|
49
|
+
node.attributes.each do |key, value|
|
50
|
+
case key
|
51
|
+
when 'orient'
|
52
|
+
@orientation = value.value.to_sym
|
53
|
+
when 'h'
|
54
|
+
@height = OoxmlSize.new(value.value.to_f)
|
55
|
+
when 'w'
|
56
|
+
@width = OoxmlSize.new(value.value.to_f)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
self
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `w:pPrDefault` tags
|
5
|
+
class ParagraphPropertiesDefault < OOXMLDocumentObject
|
6
|
+
# @return [ParagraphProperties] properties of run
|
7
|
+
attr_accessor :paragraph_properties
|
8
|
+
|
9
|
+
# Parse ParagraphPropertiesDefault object
|
10
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
11
|
+
# @return [ParagraphPropertiesDefault] result of parsing
|
12
|
+
def parse(node)
|
13
|
+
node.xpath('*').each do |node_child|
|
14
|
+
case node_child.name
|
15
|
+
when 'pPr'
|
16
|
+
@paragraph_properties = ParagraphProperties.new(parent: self).parse(node_child)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `w:rPrDefault` tags
|
5
|
+
class RunPropertiesDefault < OOXMLDocumentObject
|
6
|
+
# @return [RunProperties] properties of run
|
7
|
+
attr_accessor :run_properties
|
8
|
+
|
9
|
+
# Parse RunPropertiesDefault object
|
10
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
11
|
+
# @return [RunPropertiesDefault] result of parsing
|
12
|
+
def parse(node)
|
13
|
+
node.xpath('*').each do |node_child|
|
14
|
+
case node_child.name
|
15
|
+
when 'rPr'
|
16
|
+
@run_properties = RunProperties.new(parent: self).parse(node_child)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'document_defaults/paragraph_properties_default'
|
4
|
+
require_relative 'document_defaults/run_properties_default'
|
5
|
+
module OoxmlParser
|
6
|
+
# Class for parsing `w:docDefaults` tags
|
7
|
+
class DocumentDefaults < OOXMLDocumentObject
|
8
|
+
# @return [RunPropertiesDefault] default properties of run
|
9
|
+
attr_accessor :run_properties_default
|
10
|
+
# @return [RunPropertiesDefault] default properties of run
|
11
|
+
attr_accessor :paragraph_properties_default
|
12
|
+
|
13
|
+
# Parse Bookmark object
|
14
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
15
|
+
# @return [Bookmark] result of parsing
|
16
|
+
def parse(node)
|
17
|
+
node.xpath('*').each do |node_child|
|
18
|
+
case node_child.name
|
19
|
+
when 'rPrDefault'
|
20
|
+
@run_properties_default = RunPropertiesDefault.new(parent: self).parse(node_child)
|
21
|
+
when 'pPrDefault'
|
22
|
+
@paragraph_properties_default = ParagraphPropertiesDefault.new(parent: self).parse(node_child)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'styles/document_defaults'
|
4
|
+
module OoxmlParser
|
5
|
+
# Class for parsing `styles.xml` file
|
6
|
+
class Styles < OOXMLDocumentObject
|
7
|
+
# @return [DocumentDefaults] defaults of document
|
8
|
+
attr_accessor :document_defaults
|
9
|
+
# @return [Array<DocumentStyle>] array of document styles
|
10
|
+
attr_reader :styles
|
11
|
+
|
12
|
+
def initialize(parent: nil)
|
13
|
+
@styles = []
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
# Parse styles data
|
18
|
+
# @return [Styles] result of parsing
|
19
|
+
def parse
|
20
|
+
doc = parse_xml("#{OOXMLDocumentObject.path_to_folder}word/styles.xml")
|
21
|
+
doc.xpath('w:styles/*').each do |node_child|
|
22
|
+
case node_child.name
|
23
|
+
when 'docDefaults'
|
24
|
+
@document_defaults = DocumentDefaults.new(parent: self).parse(node_child)
|
25
|
+
when 'style'
|
26
|
+
@styles << DocumentStyle.new(parent: self).parse(node_child)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
self
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,290 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# noinspection RubyInstanceMethodNamingConvention
|
4
|
+
require_relative 'document_structure/comments'
|
5
|
+
require_relative 'document_structure/comments_extended'
|
6
|
+
require_relative 'document_structure/docx_paragraph'
|
7
|
+
require_relative 'document_structure/document_background'
|
8
|
+
require_relative 'document_structure/document_properties'
|
9
|
+
require_relative 'document_structure/document_structure_helpers'
|
10
|
+
require_relative 'document_structure/document_style'
|
11
|
+
require_relative 'document_structure/header_footer'
|
12
|
+
require_relative 'document_structure/numbering'
|
13
|
+
require_relative 'document_structure/page_properties/page_properties'
|
14
|
+
require_relative 'document_structure/document_settings'
|
15
|
+
require_relative 'document_structure/styles'
|
16
|
+
module OoxmlParser
|
17
|
+
# Basic class for DocumentStructure
|
18
|
+
class DocumentStructure < CommonDocumentStructure
|
19
|
+
include DocumentStyleHelper
|
20
|
+
include DocumentStructureHelpers
|
21
|
+
# @return [Array<OOXMLDocumentObject>] list of elements
|
22
|
+
attr_accessor :elements
|
23
|
+
# @return [PageProperties] properties of document
|
24
|
+
attr_accessor :page_properties
|
25
|
+
# @return [Note] notes of document
|
26
|
+
attr_accessor :notes
|
27
|
+
# @return [DocumentBackground] background of document
|
28
|
+
attr_accessor :background
|
29
|
+
# @return [DocumentProperties] properties of document
|
30
|
+
attr_accessor :document_properties
|
31
|
+
# @return [Comments] comment of document
|
32
|
+
attr_accessor :comments
|
33
|
+
# @return [Numbering] store numbering data
|
34
|
+
attr_accessor :numbering
|
35
|
+
# @return [Styles] styles of document
|
36
|
+
attr_accessor :styles
|
37
|
+
# @return [PresentationTheme] theme of docx
|
38
|
+
attr_accessor :theme
|
39
|
+
# @return [Relationships] relationships
|
40
|
+
attr_accessor :relationships
|
41
|
+
# @return [DocumentSettings] settings
|
42
|
+
attr_accessor :settings
|
43
|
+
# @return [CommentsDocument] comments of whole document
|
44
|
+
attr_accessor :comments_document
|
45
|
+
# @return [CommentsExtended] extended comments
|
46
|
+
attr_accessor :comments_extended
|
47
|
+
|
48
|
+
def initialize
|
49
|
+
@elements = []
|
50
|
+
@notes = []
|
51
|
+
@document_properties = DocumentProperties.new
|
52
|
+
@comments = []
|
53
|
+
super
|
54
|
+
end
|
55
|
+
|
56
|
+
alias theme_colors theme
|
57
|
+
|
58
|
+
# Compare this object to other
|
59
|
+
# @param other [Object] any other object
|
60
|
+
# @return [True, False] result of comparision
|
61
|
+
def ==(other)
|
62
|
+
@elements == other.elements &&
|
63
|
+
@page_properties == other.page_properties &&
|
64
|
+
@notes == other.notes &&
|
65
|
+
@background == other.background &&
|
66
|
+
@document_properties == other.document_properties &&
|
67
|
+
@comments == other.comments
|
68
|
+
end
|
69
|
+
|
70
|
+
# Get element by it's type
|
71
|
+
# @param location [Symbol] location of object
|
72
|
+
# @param type [Symbol] type of object
|
73
|
+
# @return [OOXMLDocumentObject]
|
74
|
+
def element_by_description(location: :canvas, type: :docx_paragraph)
|
75
|
+
case location
|
76
|
+
when :canvas
|
77
|
+
case type
|
78
|
+
when :table
|
79
|
+
elements[1].rows[0].cells[0].elements
|
80
|
+
when :docx_paragraph, :simple, :paragraph
|
81
|
+
elements
|
82
|
+
when :shape
|
83
|
+
elements[0].nonempty_runs.first.alternate_content.office2007_content.data.text_box
|
84
|
+
else
|
85
|
+
raise 'Wrong location(Need One of ":table", ":paragraph", ":shape")'
|
86
|
+
end
|
87
|
+
when :footer
|
88
|
+
case type
|
89
|
+
when :table
|
90
|
+
note_by_description(:footer1).elements[0].rows[0].cells[0].elements
|
91
|
+
when :docx_paragraph, :simple, :paragraph
|
92
|
+
note_by_description(:footer1).elements
|
93
|
+
when :shape
|
94
|
+
note_by_description(:footer1).elements[0].nonempty_runs.first.alternate_content.office2007_content.data.text_box
|
95
|
+
else
|
96
|
+
raise 'Wrong location(Need One of ":table", ":simple", ":shape")'
|
97
|
+
end
|
98
|
+
when :header
|
99
|
+
case type
|
100
|
+
when :table
|
101
|
+
note_by_description(:header1).elements[0].rows[0].cells[0].elements
|
102
|
+
when :docx_paragraph, :simple, :paragraph
|
103
|
+
note_by_description(:header1).elements
|
104
|
+
when :shape
|
105
|
+
note_by_description(:header1).elements[0].nonempty_runs.first.alternate_content.office2007_content.data.text_box
|
106
|
+
else
|
107
|
+
raise 'Wrong location(Need One of ":table", ":simple", ":shape")'
|
108
|
+
end
|
109
|
+
when :comment
|
110
|
+
comments[0].paragraphs
|
111
|
+
else
|
112
|
+
raise 'Wrong global location(Need One of ":canvas", ":footer", ":header", ":comment")'
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# Get note by it's description
|
117
|
+
# @param type [Symbol] note type
|
118
|
+
# @return [Note]
|
119
|
+
def note_by_description(type)
|
120
|
+
notes.each do |note|
|
121
|
+
return note if note.type.to_sym == type
|
122
|
+
end
|
123
|
+
raise 'There isn\'t this type of the note'
|
124
|
+
end
|
125
|
+
|
126
|
+
# Detect numbering type
|
127
|
+
# @param location [Symbol] location of object
|
128
|
+
# @param type [Symbol] type of object
|
129
|
+
# @param paragraph_number [Integer] number of object
|
130
|
+
# @return [Array<String,String>] type of numbering
|
131
|
+
def recognize_numbering(location: :canvas, type: :simple, paragraph_number: 0)
|
132
|
+
elements = element_by_description(location: location, type: type)
|
133
|
+
lvl_text = elements[paragraph_number].numbering.abstruct_numbering.level_list[0].text.value
|
134
|
+
num_format = elements[paragraph_number].numbering.abstruct_numbering.level_list[0].numbering_format.value
|
135
|
+
[num_format, lvl_text]
|
136
|
+
end
|
137
|
+
|
138
|
+
# Return outline type
|
139
|
+
# @param location [Symbol] location of object
|
140
|
+
# @param type [Symbol] type of object
|
141
|
+
# @param levels_count [Integer] count of levels to detect
|
142
|
+
# @return [Array<String,String>] type of outline
|
143
|
+
def outline(location: :canvas, type: :simple, levels_count: 1)
|
144
|
+
elements = element_by_description(location: location, type: type)
|
145
|
+
set = []
|
146
|
+
levels_count.times do |col|
|
147
|
+
set[0] = elements[col].numbering.abstruct_numbering.level_list[col].numbering_format.value
|
148
|
+
set[1] = elements[col].numbering.abstruct_numbering.level_list[col].text.value
|
149
|
+
end
|
150
|
+
set
|
151
|
+
end
|
152
|
+
|
153
|
+
# @return [Array<DocumentStyle>] style of documents
|
154
|
+
def document_styles
|
155
|
+
styles.styles
|
156
|
+
end
|
157
|
+
|
158
|
+
# Parse docx file
|
159
|
+
# @return [DocumentStructure] parsed structure
|
160
|
+
def self.parse
|
161
|
+
doc_structure = DocumentStructure.new
|
162
|
+
doc_structure.content_types = ContentTypes.new(parent: doc_structure).parse
|
163
|
+
OOXMLDocumentObject.root_subfolder = 'word/'
|
164
|
+
OOXMLDocumentObject.xmls_stack = []
|
165
|
+
@comments = []
|
166
|
+
DocumentStructure.default_paragraph_style = DocxParagraph.new
|
167
|
+
DocumentStructure.default_run_style = DocxParagraphRun.new(parent: doc_structure)
|
168
|
+
doc_structure.theme = PresentationTheme.parse('word/theme/theme1.xml')
|
169
|
+
doc_structure.relationships = Relationships.new(parent: self).parse_file("#{OOXMLDocumentObject.path_to_folder}word/_rels/document.xml.rels")
|
170
|
+
doc_structure.parse_styles
|
171
|
+
number = 0
|
172
|
+
OOXMLDocumentObject.add_to_xmls_stack('word/document.xml')
|
173
|
+
doc = doc_structure.parse_xml(OOXMLDocumentObject.current_xml)
|
174
|
+
doc.search('//w:document').each do |document|
|
175
|
+
document.xpath('w:background').each do |background|
|
176
|
+
doc_structure.background = DocumentBackground.new(parent: doc_structure).parse(background)
|
177
|
+
end
|
178
|
+
document.xpath('w:body').each do |body|
|
179
|
+
body.xpath('*').each do |element|
|
180
|
+
case element.name
|
181
|
+
when 'p'
|
182
|
+
child = element.child
|
183
|
+
unless child.nil? && doc_structure.elements.last.instance_of?(Table)
|
184
|
+
paragraph_style = DocumentStructure.default_paragraph_style.dup.parse(element, number, DocumentStructure.default_run_style, parent: doc_structure)
|
185
|
+
number += 1
|
186
|
+
doc_structure.elements << paragraph_style.dup
|
187
|
+
end
|
188
|
+
when 'tbl'
|
189
|
+
table = Table.new(parent: doc_structure).parse(element,
|
190
|
+
number,
|
191
|
+
TableProperties.new)
|
192
|
+
number += 1
|
193
|
+
doc_structure.elements << table
|
194
|
+
when 'sdt'
|
195
|
+
doc_structure.elements << StructuredDocumentTag.new(parent: doc_structure).parse(element)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
body.xpath('w:sectPr').each do |sect_pr|
|
199
|
+
doc_structure.page_properties = PageProperties.new(parent: doc_structure).parse(sect_pr,
|
200
|
+
DocumentStructure.default_paragraph_style,
|
201
|
+
DocumentStructure.default_run_style)
|
202
|
+
doc_structure.notes = doc_structure.page_properties.notes # keep copy of notes to compatibility with previous docx models
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
OOXMLDocumentObject.xmls_stack.pop
|
207
|
+
doc_structure.document_properties = DocumentProperties.new(parent: doc_structure).parse
|
208
|
+
doc_structure.comments = Comments.new(parent: doc_structure).parse
|
209
|
+
doc_structure.comments_extended = CommentsExtended.new(parent: doc_structure).parse
|
210
|
+
doc_structure.comments_document = Comments.new(parent: doc_structure,
|
211
|
+
file: "#{OOXMLDocumentObject.path_to_folder}word/#{doc_structure.relationships.target_by_type('commentsDocument').first}")
|
212
|
+
.parse
|
213
|
+
doc_structure.settings = DocumentSettings.new(parent: doc_structure).parse
|
214
|
+
doc_structure
|
215
|
+
end
|
216
|
+
|
217
|
+
# Parse default style
|
218
|
+
# @return [void]
|
219
|
+
def parse_default_style
|
220
|
+
doc = parse_xml("#{OOXMLDocumentObject.path_to_folder}word/styles.xml")
|
221
|
+
doc.search('//w:style').each do |style|
|
222
|
+
next if style.attribute('default').nil?
|
223
|
+
|
224
|
+
if (style.attribute('default').value == '1' ||
|
225
|
+
style.attribute('default').value == 'on' ||
|
226
|
+
style.attribute('default').value == 'true') &&
|
227
|
+
style.attribute('type').value == 'paragraph'
|
228
|
+
style.xpath('w:pPr').each do |paragraph_pr_tag|
|
229
|
+
DocumentStructure.default_paragraph_style = DocxParagraph.new.parse_paragraph_style(paragraph_pr_tag, DocumentStructure.default_run_style)
|
230
|
+
end
|
231
|
+
style.xpath('w:rPr').each do |character_pr_tag|
|
232
|
+
DocumentStructure.default_run_style.parse_properties(character_pr_tag)
|
233
|
+
end
|
234
|
+
elsif (style.attribute('default').value == '1' ||
|
235
|
+
style.attribute('default').value == 'on' ||
|
236
|
+
style.attribute('default').value == 'true') &&
|
237
|
+
style.attribute('type').value == 'character'
|
238
|
+
style.xpath('w:rPr').each do |character_pr_tag|
|
239
|
+
DocumentStructure.default_run_style.parse_properties(character_pr_tag)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
DocumentStructure.default_table_paragraph_style = DocumentStructure.default_paragraph_style.dup
|
244
|
+
DocumentStructure.default_table_paragraph_style.spacing = Spacing.new(0, 0, 1, :auto)
|
245
|
+
DocumentStructure.default_table_run_style = DocumentStructure.default_run_style.dup
|
246
|
+
doc.search('//w:style').each do |style|
|
247
|
+
next if style.attribute('default').nil?
|
248
|
+
next unless (style.attribute('default').value == '1' ||
|
249
|
+
style.attribute('default').value == 'on' ||
|
250
|
+
style.attribute('default').value == 'true') &&
|
251
|
+
style.attribute('type').value == 'table'
|
252
|
+
|
253
|
+
style.xpath('w:rPr').each do |table_character_pr_tag|
|
254
|
+
DocumentStructure.default_table_run_style.parse_properties(table_character_pr_tag)
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
# Perform parsing styles.xml
|
260
|
+
def parse_styles
|
261
|
+
file = "#{OOXMLDocumentObject.path_to_folder}/word/styles.xml"
|
262
|
+
DocumentStructure.default_paragraph_style = DocxParagraph.new(parent: self)
|
263
|
+
DocumentStructure.default_table_paragraph_style = DocxParagraph.new(parent: self)
|
264
|
+
DocumentStructure.default_run_style = DocxParagraphRun.new(parent: self)
|
265
|
+
DocumentStructure.default_table_run_style = DocxParagraphRun.new(parent: self)
|
266
|
+
|
267
|
+
return unless File.exist?(file)
|
268
|
+
|
269
|
+
doc = parse_xml(file)
|
270
|
+
# TODO: Remove this old way parsing in favor of doc_structure.styles.document_defaults
|
271
|
+
doc.search('//w:docDefaults').each do |doc_defaults|
|
272
|
+
doc_defaults.xpath('w:pPrDefault').each do |p_pr_defaults|
|
273
|
+
DocumentStructure.default_paragraph_style = DocxParagraph.new(parent: self).parse(p_pr_defaults, 0)
|
274
|
+
end
|
275
|
+
doc_defaults.xpath('w:rPrDefault').each do |r_pr_defaults|
|
276
|
+
r_pr_defaults.xpath('w:rPr').each do |r_pr|
|
277
|
+
DocumentStructure.default_run_style = DocxParagraphRun.new(parent: self).parse_properties(r_pr)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
parse_default_style
|
282
|
+
@numbering = Numbering.new(parent: self).parse
|
283
|
+
@styles = Styles.new(parent: self).parse
|
284
|
+
end
|
285
|
+
|
286
|
+
class << self
|
287
|
+
attr_accessor :default_table_run_style, :default_table_paragraph_style, :default_paragraph_style, :default_run_style
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|