ooxml_parser 0.4.0 → 0.7.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 +4 -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 +39 -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 +22 -9
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +5 -5
- 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 +5 -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 +12 -8
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +26 -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 +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +8 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +2 -2
- 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 +3 -3
- 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 +5 -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 -2
- 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 +6 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +4 -4
- 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 +3 -3
- 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 +3 -3
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +25 -9
- data/lib/ooxml_parser/common_parser/common_data/color.rb +119 -71
- 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 +12 -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 +23 -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 +6 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +18 -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 +38 -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/coordinates.rb +18 -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 +42 -3
- 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 +27 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +9 -16
- 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 +4 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +4 -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 +25 -35
- 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 +5 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +6 -8
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +10 -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 +10 -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 +8 -5
- 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 +11 -11
- 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 +27 -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 +5 -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 +6 -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 +100 -41
- 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 +37 -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 +11 -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 +93 -82
- 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.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 +5 -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 +30 -23
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +15 -4
- 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 -8
- 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 +6 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +5 -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 +2 -0
- 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 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +12 -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 +16 -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 +5 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +14 -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 +6 -0
- data/lib/ooxml_parser/helpers/string_helper.rb +3 -1
- data/lib/ooxml_parser/name.rb +9 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +32 -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 +12 -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 +14 -8
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +11 -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 +7 -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 +19 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +6 -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 +7 -1
- data/lib/ooxml_parser/version.rb +4 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +57 -38
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +6 -1
- 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_cache/pivot_cache_definition.rb +37 -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/cache_source/worksheet_source.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/shared_string_table/string_index.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +15 -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 +150 -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 +4 -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 +5 -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 +56 -25
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +32 -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 +12 -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 +7 -1
- metadata +147 -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,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OoxmlParser
|
4
|
+
# Class with data of Note
|
2
5
|
class Note < OOXMLDocumentObject
|
3
6
|
attr_accessor :type, :elements, :assigned_to
|
4
7
|
|
@@ -6,18 +9,19 @@ module OoxmlParser
|
|
6
9
|
@elements = []
|
7
10
|
end
|
8
11
|
|
12
|
+
# Parse note data
|
13
|
+
# @param params [Hash] data to parse
|
14
|
+
# @return [Note] result of parsing
|
9
15
|
def self.parse(params)
|
10
16
|
note = Note.new
|
11
17
|
note.type = params[:type]
|
12
18
|
note.assigned_to = params[:assigned_to]
|
13
19
|
note.parent = params[:parent]
|
14
|
-
doc =
|
20
|
+
doc = note.parse_xml(note.file_path(params[:target]))
|
15
21
|
if note.type.include?('footer')
|
16
22
|
xpath_note = '//w:ftr'
|
17
23
|
elsif note.type.include?('header')
|
18
24
|
xpath_note = '//w:hdr'
|
19
|
-
else
|
20
|
-
raise "Cannot parse unknown Note type: #{type}"
|
21
25
|
end
|
22
26
|
doc.search(xpath_note).each do |ftr|
|
23
27
|
number = 0
|
@@ -28,21 +32,19 @@ module OoxmlParser
|
|
28
32
|
elsif sub_element.name == 'tbl'
|
29
33
|
note.elements << Table.new(parent: note).parse(sub_element, number)
|
30
34
|
number += 1
|
31
|
-
elsif sub_element.name == 'std'
|
32
|
-
sub_element.xpath('w:p').each do |p|
|
33
|
-
note.elements << params[:default_paragraph].copy.parse(p, number, params[:default_character])
|
34
|
-
number += 1
|
35
|
-
end
|
36
|
-
sub_element.xpath('w:sdtContent').each do |sdt_content|
|
37
|
-
sdt_content.xpath('w:p').each do |p|
|
38
|
-
note.elements << params[:default_paragraph].copy.parse(p, number, params[:default_character])
|
39
|
-
number += 1
|
40
|
-
end
|
41
|
-
end
|
42
35
|
end
|
43
36
|
end
|
44
37
|
end
|
45
38
|
note
|
46
39
|
end
|
40
|
+
|
41
|
+
# @param target [String] name of target
|
42
|
+
# @return [String] path to note xml file
|
43
|
+
def file_path(target)
|
44
|
+
file = "#{OOXMLDocumentObject.path_to_folder}word/#{target}"
|
45
|
+
return file if File.exist?(file)
|
46
|
+
|
47
|
+
"#{OOXMLDocumentObject.path_to_folder}#{target}" unless File.exist?(file)
|
48
|
+
end
|
47
49
|
end
|
48
50
|
end
|
data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OoxmlParser
|
2
4
|
# Class for parsing `pgMar` tags
|
3
5
|
class PageMargins < OOXMLDocumentObject
|
@@ -17,23 +19,23 @@ module OoxmlParser
|
|
17
19
|
# Parse BordersProperties
|
18
20
|
# @param [Nokogiri::XML:Element] node with PageMargins
|
19
21
|
# @return [PageMargins] value of PageMargins
|
20
|
-
def parse(node)
|
22
|
+
def parse(node, unit = :dxa)
|
21
23
|
node.attributes.each do |key, value|
|
22
24
|
case key
|
23
25
|
when 'top'
|
24
|
-
@top = OoxmlSize.new(value.value.to_f)
|
26
|
+
@top = OoxmlSize.new(value.value.to_f, unit)
|
25
27
|
when 'left'
|
26
|
-
@left = OoxmlSize.new(value.value.to_f)
|
28
|
+
@left = OoxmlSize.new(value.value.to_f, unit)
|
27
29
|
when 'right'
|
28
|
-
@right = OoxmlSize.new(value.value.to_f)
|
30
|
+
@right = OoxmlSize.new(value.value.to_f, unit)
|
29
31
|
when 'bottom'
|
30
|
-
@bottom = OoxmlSize.new(value.value.to_f)
|
32
|
+
@bottom = OoxmlSize.new(value.value.to_f, unit)
|
31
33
|
when 'header'
|
32
|
-
@header = OoxmlSize.new(value.value.to_f)
|
34
|
+
@header = OoxmlSize.new(value.value.to_f, unit)
|
33
35
|
when 'footer'
|
34
|
-
@footer = OoxmlSize.new(value.value.to_f)
|
36
|
+
@footer = OoxmlSize.new(value.value.to_f, unit)
|
35
37
|
when 'gutter'
|
36
|
-
@gutter = OoxmlSize.new(value.value.to_f)
|
38
|
+
@gutter = OoxmlSize.new(value.value.to_f, unit)
|
37
39
|
end
|
38
40
|
end
|
39
41
|
self
|
data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'document_grid'
|
2
4
|
require_relative 'footnote_properties'
|
3
5
|
require_relative 'page_size'
|
@@ -5,6 +7,7 @@ require_relative 'page_margins'
|
|
5
7
|
require_relative 'columns'
|
6
8
|
require_relative 'note'
|
7
9
|
module OoxmlParser
|
10
|
+
# Class for data of PageProperties
|
8
11
|
class PageProperties < OOXMLDocumentObject
|
9
12
|
attr_accessor :type, :size, :margins, :document_grid, :num_type, :form_prot, :text_direction, :page_borders, :columns,
|
10
13
|
:notes
|
@@ -1,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OoxmlParser
|
4
|
+
# Class for data of PageSize
|
2
5
|
class PageSize < OOXMLDocumentObject
|
3
6
|
attr_accessor :height, :width, :orientation
|
4
7
|
|
@@ -8,6 +11,7 @@ module OoxmlParser
|
|
8
11
|
@orientation = orientation
|
9
12
|
end
|
10
13
|
|
14
|
+
# @return [String] convert to string
|
11
15
|
def to_s
|
12
16
|
'Height: ' + @height.to_s + ' Width: ' + @width.to_s + ' Orientation: ' + @orientation.to_s
|
13
17
|
end
|
@@ -33,6 +37,7 @@ module OoxmlParser
|
|
33
37
|
return 'ROC 16K' if same_dimensions?(PageSize.new(OoxmlSize.new(27.3, :centimeter), OoxmlSize.new(19.68, :centimeter)))
|
34
38
|
return 'Envelope Choukei 3' if same_dimensions?(PageSize.new(OoxmlSize.new(23.49, :centimeter), OoxmlSize.new(11.99, :centimeter)))
|
35
39
|
return 'Super B/A3' if same_dimensions?(PageSize.new(OoxmlSize.new(48.25, :centimeter), OoxmlSize.new(33.02, :centimeter)))
|
40
|
+
|
36
41
|
"Unknown page size: Height #{@height} Width #{@width}"
|
37
42
|
end
|
38
43
|
|
@@ -1,16 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'styles/document_defaults'
|
2
4
|
module OoxmlParser
|
3
5
|
# Class for parsing `styles.xml` file
|
4
6
|
class Styles < OOXMLDocumentObject
|
5
7
|
# @return [DocumentDefaults] defaults of document
|
6
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
|
+
@parent = parent
|
15
|
+
end
|
7
16
|
|
17
|
+
# Parse styles data
|
18
|
+
# @return [Styles] result of parsing
|
8
19
|
def parse
|
9
|
-
doc =
|
20
|
+
doc = parse_xml(OOXMLDocumentObject.path_to_folder + 'word/styles.xml')
|
10
21
|
doc.xpath('w:styles/*').each do |node_child|
|
11
22
|
case node_child.name
|
12
23
|
when 'docDefaults'
|
13
24
|
@document_defaults = DocumentDefaults.new(parent: self).parse(node_child)
|
25
|
+
when 'style'
|
26
|
+
@styles << DocumentStyle.new(parent: self).parse(node_child)
|
14
27
|
end
|
15
28
|
end
|
16
29
|
self
|
@@ -1,9 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../common_parser/common_data/ooxml_document_object'
|
2
4
|
require_relative '../common_parser/common_data/valued_child'
|
3
5
|
require_relative 'docx_data/document_structure'
|
4
6
|
|
5
7
|
module OoxmlParser
|
8
|
+
# Basic class for DocxParser
|
6
9
|
class DocxParser
|
10
|
+
# Parse docx file
|
11
|
+
# @param path_to_file [String] file path
|
12
|
+
# @return [DocumentStructure] result of parse
|
7
13
|
def self.parse_docx(path_to_file)
|
8
14
|
Parser.parse_format(path_to_file) do
|
9
15
|
DocumentStructure.parse
|
@@ -1,67 +1,62 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'presentation/comment_authors'
|
4
|
+
require_relative 'presentation/presentation_comments'
|
2
5
|
require_relative 'presentation/presentation_helpers'
|
3
6
|
require_relative 'presentation/presentation_theme'
|
4
7
|
require_relative 'presentation/slide'
|
5
8
|
require_relative 'presentation/slide_size'
|
9
|
+
require_relative 'presentation/table_styles'
|
6
10
|
module OoxmlParser
|
11
|
+
# Basic class for all parsed pptx data
|
7
12
|
class Presentation < CommonDocumentStructure
|
8
13
|
include PresentationHelpers
|
9
|
-
attr_accessor :slides, :theme, :slide_size
|
14
|
+
attr_accessor :slides, :theme, :slide_size
|
10
15
|
# @return [Relationships] relationships of presentation
|
11
16
|
attr_accessor :relationships
|
17
|
+
# @return [TableStyles] table styles data
|
18
|
+
attr_accessor :table_styles
|
19
|
+
# @return [CommentAuthors] authors of presentation
|
20
|
+
attr_reader :comment_authors
|
21
|
+
# @return [PresentationComments] comments of presentation
|
22
|
+
attr_reader :comments
|
12
23
|
|
13
|
-
def initialize(
|
14
|
-
@slides =
|
15
|
-
@
|
16
|
-
|
24
|
+
def initialize(params = {})
|
25
|
+
@slides = []
|
26
|
+
@comments = []
|
27
|
+
super
|
17
28
|
end
|
18
29
|
|
19
|
-
|
30
|
+
# Parse data of presentation
|
31
|
+
# @return [Presentation] parsed presentation
|
32
|
+
def parse
|
33
|
+
@content_types = ContentTypes.new(parent: self).parse
|
20
34
|
OOXMLDocumentObject.root_subfolder = 'ppt/'
|
21
35
|
OOXMLDocumentObject.xmls_stack = []
|
22
36
|
OOXMLDocumentObject.add_to_xmls_stack('ppt/presentation.xml')
|
23
|
-
doc =
|
24
|
-
|
25
|
-
|
37
|
+
doc = parse_xml(OOXMLDocumentObject.current_xml)
|
38
|
+
@theme = PresentationTheme.parse('ppt/theme/theme1.xml')
|
39
|
+
@table_styles = TableStyles.new(parent: self).parse
|
40
|
+
@comment_authors = CommentAuthors.new(parent: self).parse
|
41
|
+
@comments = PresentationComments.new(parent: self).parse
|
26
42
|
presentation_node = doc.search('//p:presentation').first
|
27
43
|
presentation_node.xpath('*').each do |presentation_node_child|
|
28
44
|
case presentation_node_child.name
|
29
45
|
when 'sldSz'
|
30
|
-
|
46
|
+
@slide_size = SlideSize.new(parent: self).parse(presentation_node_child)
|
31
47
|
when 'sldIdLst'
|
32
48
|
presentation_node_child.xpath('p:sldId').each do |silde_id_node|
|
33
49
|
id = nil
|
34
50
|
silde_id_node.attribute_nodes.select { |node| id = node.to_s if node.namespace && node.namespace.prefix == 'r' }
|
35
|
-
|
36
|
-
|
37
|
-
|
51
|
+
@slides << Slide.new(parent: self,
|
52
|
+
xml_path: "#{OOXMLDocumentObject.root_subfolder}/#{OOXMLDocumentObject.get_link_from_rels(id)}")
|
53
|
+
.parse
|
38
54
|
end
|
39
55
|
end
|
40
56
|
end
|
41
|
-
presentation.comments = PresentationComment.parse_list
|
42
57
|
OOXMLDocumentObject.xmls_stack.pop
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
class << self
|
48
|
-
# @return [FontStyle] current font_style
|
49
|
-
attr_writer :current_font_style
|
50
|
-
|
51
|
-
def current_font_style
|
52
|
-
@current_font_style = FontStyle.new if @current_font_style.nil?
|
53
|
-
@current_font_style
|
54
|
-
end
|
55
|
-
|
56
|
-
# @return [String] default_font_typeface
|
57
|
-
def default_font_typeface
|
58
|
-
'Arial'
|
59
|
-
end
|
60
|
-
|
61
|
-
# @return [FixNum] default_font_typeface
|
62
|
-
def default_font_size
|
63
|
-
18
|
64
|
-
end
|
58
|
+
@relationships = Relationships.new(parent: self).parse_file("#{OOXMLDocumentObject.path_to_folder}/ppt/_rels/presentation.xml.rels")
|
59
|
+
self
|
65
60
|
end
|
66
61
|
end
|
67
62
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'comment_authors/comment_author'
|
4
|
+
module OoxmlParser
|
5
|
+
# Class for parsing `commentAuthors.xml` file
|
6
|
+
class CommentAuthors < OOXMLDocumentObject
|
7
|
+
# @return [Array<CommentAuthor>] list of comment authors
|
8
|
+
attr_reader :list
|
9
|
+
|
10
|
+
def initialize(parent: nil)
|
11
|
+
@list = []
|
12
|
+
@parent = parent
|
13
|
+
end
|
14
|
+
|
15
|
+
# Parse CommentAuthors object
|
16
|
+
# @param file [Nokogiri::XML:Element] node to parse
|
17
|
+
# @return [CommentAuthors] result of parsing
|
18
|
+
def parse(file = "#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/commentAuthors.xml")
|
19
|
+
return nil unless File.exist?(file)
|
20
|
+
|
21
|
+
document = parse_xml(File.open(file))
|
22
|
+
node = document.xpath('*').first
|
23
|
+
|
24
|
+
node.xpath('*').each do |node_child|
|
25
|
+
case node_child.name
|
26
|
+
when 'cmAuthor'
|
27
|
+
@list << CommentAuthor.new(parent: self).parse(node_child)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
self
|
31
|
+
end
|
32
|
+
|
33
|
+
# @param id [Integer] id of author
|
34
|
+
# @return [CommentAuthor] author by id
|
35
|
+
def author_by_id(id)
|
36
|
+
list.detect { |author| author.id == id }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `cmAuthor` tag
|
5
|
+
class CommentAuthor < OOXMLDocumentObject
|
6
|
+
# @return [Integer] Comment Author ID
|
7
|
+
attr_reader :id
|
8
|
+
# @return [String] Author Name
|
9
|
+
attr_reader :name
|
10
|
+
# @return [String] Author Initials
|
11
|
+
attr_reader :initials
|
12
|
+
# @return [Integer] Index of Comment Author's last comment
|
13
|
+
attr_reader :last_index
|
14
|
+
# @return [Integer] Comment Author Color Index
|
15
|
+
attr_reader :color_index
|
16
|
+
|
17
|
+
# Parse CommentAuthor object
|
18
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
19
|
+
# @return [CommentAuthor] result of parsing
|
20
|
+
def parse(node)
|
21
|
+
node.attributes.each do |key, value|
|
22
|
+
case key
|
23
|
+
when 'id'
|
24
|
+
@id = value.value.to_i
|
25
|
+
when 'name'
|
26
|
+
@name = value.value.to_s
|
27
|
+
when 'initials'
|
28
|
+
@initials = value.value.to_s
|
29
|
+
when 'lastIdx'
|
30
|
+
@last_index = value.value.to_i
|
31
|
+
when 'clrIdx'
|
32
|
+
@color_index = value.value.to_i
|
33
|
+
end
|
34
|
+
end
|
35
|
+
self
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'presentation_comments/presentation_comment'
|
4
|
+
module OoxmlParser
|
5
|
+
# Class for parsing `comment1.xml` file
|
6
|
+
class PresentationComments < OOXMLDocumentObject
|
7
|
+
# @return [Array<PresentationComment>] list of comments
|
8
|
+
attr_reader :list
|
9
|
+
|
10
|
+
def initialize(parent: nil)
|
11
|
+
@list = []
|
12
|
+
@parent = parent
|
13
|
+
end
|
14
|
+
|
15
|
+
# Parse PresentationComments object
|
16
|
+
# @param file [Nokogiri::XML:Element] node to parse
|
17
|
+
# @return [PresentationComments] result of parsing
|
18
|
+
def parse(file = "#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/comments/comment1.xml")
|
19
|
+
return nil unless File.exist?(file)
|
20
|
+
|
21
|
+
document = parse_xml(File.open(file))
|
22
|
+
node = document.xpath('*').first
|
23
|
+
|
24
|
+
node.xpath('*').each do |node_child|
|
25
|
+
case node_child.name
|
26
|
+
when 'cm'
|
27
|
+
@list << PresentationComment.new(parent: self).parse(node_child)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
self
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `p:cm` tag
|
5
|
+
class PresentationComment < OOXMLDocumentObject
|
6
|
+
# @return [Integer] id of author
|
7
|
+
attr_reader :author_id
|
8
|
+
# @return [OOXMLCoordinates] position of comment
|
9
|
+
attr_reader :position
|
10
|
+
# @return [String] text of comment
|
11
|
+
attr_reader :text
|
12
|
+
|
13
|
+
# @return [CommentAuthor] author of comment
|
14
|
+
def author
|
15
|
+
root_object.comment_authors.author_by_id(@author_id)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Parse PresentationComment object
|
19
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
20
|
+
# @return [PresentationComment] result of parsing
|
21
|
+
def parse(node)
|
22
|
+
node.attributes.each do |key, value|
|
23
|
+
case key
|
24
|
+
when 'authorId'
|
25
|
+
@author_id = value.value.to_i
|
26
|
+
end
|
27
|
+
end
|
28
|
+
node.xpath('*').each do |node_child|
|
29
|
+
case node_child.name
|
30
|
+
when 'pos'
|
31
|
+
@position = OOXMLCoordinates.parse(node_child, x_attr: 'x', y_attr: 'y')
|
32
|
+
when 'text'
|
33
|
+
@text = node_child.text.to_s
|
34
|
+
end
|
35
|
+
end
|
36
|
+
self
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|