ooxml_parser 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ooxml_parser.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/chart_style.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +33 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats/pivot_format.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area.rb +67 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area/common_chart_data.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +20 -7
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +5 -3
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/{string_reference.rb → number_string_reference.rb} +9 -7
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/{string_cache.rb → number_string_cache.rb} +11 -6
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point.rb +9 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point/text_value.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/x_y_values.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/view_3d.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis/scaling.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +7 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_point.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +6 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing/doc_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +11 -8
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +23 -14
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_horizontal.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_vertical.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties/shape_placeholder.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties/preset_text_warp.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +5 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip/alpha_mod_fix.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list/shape_guide.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +12 -11
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +11 -5
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_element.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +22 -9
- data/lib/ooxml_parser/common_parser/common_data/color.rb +83 -67
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +25 -21
- data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +7 -3
- data/lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb +4 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +12 -8
- data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +6 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +5 -3
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +5 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +14 -14
- data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types.rb +36 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_default.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_override.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +11 -6
- data/lib/ooxml_parser/common_parser/common_data/font_style.rb +3 -2
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +19 -2
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +107 -116
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_object_attribute_helper.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +24 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +9 -8
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +9 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/text.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +5 -3
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +12 -25
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing/line_spacing.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/tab.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/relationships.rb +24 -19
- data/lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +3 -8
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_layout.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +9 -2
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +19 -17
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +4 -1
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_row_band_size.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +7 -4
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +21 -39
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line/line_join.rb +4 -4
- data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +5 -2
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties/table_row_height.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid/grid_column.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +26 -4
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties/table_borders.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_document_structure.rb +17 -0
- data/lib/ooxml_parser/common_parser/parser.rb +6 -2
- data/lib/ooxml_parser/configuration.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +72 -37
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments.rb +36 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +34 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended.rb +4 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended/comment_extended.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +3 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +6 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb +2 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +8 -12
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +71 -81
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_end.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_start.rb +26 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_end.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_start.rb +26 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties/argument_size.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +4 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_grow.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_limit_location.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +4 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_helper.rb +11 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +17 -20
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +11 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +39 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_margins.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_size.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/stroke.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb +41 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb +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 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +7 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/multilevel_type.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +3 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_justification.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_text.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/numbering_format.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition.rb +4 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +6 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/footnote_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +13 -14
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +10 -8
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +4 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +12 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/paragraph_properties_default.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/run_properties_default.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_parser.rb +3 -0
- data/lib/ooxml_parser/helpers/string_helper.rb +3 -1
- data/lib/ooxml_parser/name.rb +8 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +30 -37
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors.rb +39 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors/comment_author.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb +33 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb +39 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_helpers.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +9 -3
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme.rb +36 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection.rb +31 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection/text_font.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +11 -8
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +8 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +4 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties/stretch.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/connection_shape.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +5 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +2 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_notes.rb +3 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +3 -9
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +4 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +6 -3
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/{condition.rb → codition_list/condition.rb} +3 -9
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition_list.rb +27 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +4 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb +5 -5
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +8 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties/wheel.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/table_styles.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +4 -1
- data/lib/ooxml_parser/version.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +38 -38
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table.rb +46 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table/string_index.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +13 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/{worksheet/xlsx_row/xlsx_cell → style_sheet/cell_xfs}/cell_style/alignment.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +145 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +5 -3
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +2 -5
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats/number_format.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders/xlsx_border.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb +3 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +51 -25
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +28 -29
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/author.rb +16 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/comment_list.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +10 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/ole_objects.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/page_setup.rb +105 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb +8 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb +12 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters/custom_filter.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns/table_column.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/worksheet_helper.rb +14 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +8 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +3 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +60 -27
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb +39 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +4 -1
- metadata +82 -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,6 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'transition_properties/wheel'
|
1
4
|
module OoxmlParser
|
5
|
+
# Class for data for TransitionProperties
|
2
6
|
class TransitionProperties < OOXMLDocumentObject
|
3
7
|
attr_accessor :type, :through_black, :direction, :orientation, :spokes
|
8
|
+
# @return [Wheel] Wheel Slide Transition
|
9
|
+
attr_reader :wheel
|
4
10
|
|
5
11
|
# Parse TransitionProperties object
|
6
12
|
# @param node [Nokogiri::XML:Element] node to parse
|
@@ -15,8 +21,8 @@ module OoxmlParser
|
|
15
21
|
when 'split'
|
16
22
|
@direction = value_to_symbol(node.attribute('dir')) if node.attribute('dir')
|
17
23
|
@orientation = node.attribute('orient').value.to_sym if node.attribute('orient')
|
18
|
-
when 'wheel'
|
19
|
-
@
|
24
|
+
when 'wheel'
|
25
|
+
@wheel = Wheel.new(parent: self).parse(node)
|
20
26
|
end
|
21
27
|
self
|
22
28
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for Wheel Slide Transition `p:wheel` tag
|
5
|
+
class Wheel < OOXMLDocumentObject
|
6
|
+
# @return [Integer] count of spokes
|
7
|
+
attr_reader :spokes
|
8
|
+
|
9
|
+
# Parse Wheel object
|
10
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
11
|
+
# @return [Wheel] result of parsing
|
12
|
+
def parse(node)
|
13
|
+
node.attributes.each do |key, value|
|
14
|
+
case key
|
15
|
+
when 'spokes'
|
16
|
+
@spokes = value.value.to_i
|
17
|
+
end
|
18
|
+
end
|
19
|
+
self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `tableStyles.xml` file
|
5
|
+
class TableStyles < OOXMLDocumentObject
|
6
|
+
# @return [Array<TableStyle>] list of table styles
|
7
|
+
attr_reader :table_style_list
|
8
|
+
|
9
|
+
def initialize(parent: nil)
|
10
|
+
@table_style_list = []
|
11
|
+
@parent = parent
|
12
|
+
end
|
13
|
+
|
14
|
+
# Parse TableStyles object
|
15
|
+
# @param file [Nokogiri::XML:Element] node to parse
|
16
|
+
# @return [TableStyles] result of parsing
|
17
|
+
def parse(file = "#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/tableStyles.xml")
|
18
|
+
return nil unless File.exist?(file)
|
19
|
+
|
20
|
+
document = parse_xml(file)
|
21
|
+
node = document.xpath('*').first
|
22
|
+
|
23
|
+
node.xpath('*').each do |node_child|
|
24
|
+
case node_child.name
|
25
|
+
when 'tblStyle'
|
26
|
+
@table_style_list << TableStyle.new(parent: self).parse(node_child)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
# @param id [String] style to find
|
33
|
+
# @return [TableStyle] style by this id
|
34
|
+
def style_by_id(id)
|
35
|
+
table_style_list.detect { |style| style.id == id }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,10 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'pptx_data/presentation.rb'
|
2
4
|
|
3
5
|
module OoxmlParser
|
6
|
+
# Basic class for parsing pptx
|
4
7
|
class PptxParser
|
5
8
|
def self.parse_pptx(path_to_file)
|
6
9
|
Parser.parse_format(path_to_file) do
|
7
|
-
Presentation.parse
|
10
|
+
Presentation.new.parse
|
8
11
|
end
|
9
12
|
end
|
10
13
|
end
|
data/lib/ooxml_parser/version.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'workbook/chartsheet'
|
4
|
+
require_relative 'workbook/shared_string_table'
|
2
5
|
require_relative 'workbook/style_sheet'
|
3
6
|
require_relative 'workbook/worksheet'
|
4
7
|
require_relative 'workbook/workbook_helpers'
|
5
|
-
# Class for storing XLSX Workbook
|
6
8
|
module OoxmlParser
|
9
|
+
# Class for storing XLSX Workbook
|
7
10
|
class XLSXWorkbook < CommonDocumentStructure
|
8
11
|
include WorkbookHelpers
|
9
12
|
attr_accessor :worksheets
|
@@ -13,17 +16,21 @@ module OoxmlParser
|
|
13
16
|
attr_accessor :relationships
|
14
17
|
# @return [StyleSheet] styles of book
|
15
18
|
attr_accessor :style_sheet
|
19
|
+
# @return [SharedStringTable] styles of book
|
20
|
+
attr_accessor :shared_strings_table
|
16
21
|
|
17
|
-
def initialize(
|
18
|
-
@worksheets =
|
22
|
+
def initialize(params = {})
|
23
|
+
@worksheets = []
|
24
|
+
super
|
19
25
|
end
|
20
26
|
|
21
27
|
def cell(column, row, sheet = 0)
|
22
|
-
column = Coordinates.new(row, column).
|
28
|
+
column = Coordinates.new(row, column).column_number unless StringHelper.numeric?(column.to_s)
|
23
29
|
|
24
30
|
if StringHelper.numeric?(sheet.to_s)
|
25
31
|
row = @worksheets[sheet].rows[row.to_i - 1]
|
26
32
|
return nil if row.nil?
|
33
|
+
|
27
34
|
return row.cells[column.to_i - 1]
|
28
35
|
elsif sheet.is_a?(String)
|
29
36
|
@worksheets.each do |worksheet|
|
@@ -36,10 +43,6 @@ module OoxmlParser
|
|
36
43
|
raise "Error. Wrong sheet value: #{sheet}"
|
37
44
|
end
|
38
45
|
|
39
|
-
def difference(other)
|
40
|
-
Hash.object_to_hash(self).diff(Hash.object_to_hash(other))
|
41
|
-
end
|
42
|
-
|
43
46
|
# Get all values of formulas.
|
44
47
|
# @param [Fixnum] precision of formulas counting
|
45
48
|
# @return [Array, String] all formulas
|
@@ -47,11 +50,15 @@ module OoxmlParser
|
|
47
50
|
formulas = []
|
48
51
|
worksheets.each do |c_sheet|
|
49
52
|
next unless c_sheet
|
53
|
+
|
50
54
|
c_sheet.rows.each do |c_row|
|
51
55
|
next unless c_row
|
56
|
+
|
52
57
|
c_row.cells.each do |c_cell|
|
53
58
|
next unless c_cell
|
54
59
|
next unless c_cell.formula
|
60
|
+
next if c_cell.formula.empty?
|
61
|
+
|
55
62
|
text = c_cell.raw_text
|
56
63
|
if StringHelper.numeric?(text)
|
57
64
|
text = text.to_f.round(10).to_s[0..precision]
|
@@ -72,49 +79,42 @@ module OoxmlParser
|
|
72
79
|
formulas
|
73
80
|
end
|
74
81
|
|
75
|
-
|
76
|
-
|
77
|
-
|
82
|
+
# Do work for parsing shared strings file
|
83
|
+
def parse_shared_strings
|
84
|
+
shared_strings_target = relationships.target_by_type('sharedString')
|
85
|
+
return if shared_strings_target.empty?
|
86
|
+
|
87
|
+
shared_string_file = "#{OOXMLDocumentObject.path_to_folder}/xl/#{shared_strings_target.first}"
|
88
|
+
@shared_strings_table = SharedStringTable.new(parent: self).parse(shared_string_file)
|
89
|
+
end
|
90
|
+
|
91
|
+
def parse
|
92
|
+
@content_types = ContentTypes.new(parent: self).parse
|
93
|
+
@relationships = Relationships.new(parent: self).parse_file("#{OOXMLDocumentObject.path_to_folder}xl/_rels/workbook.xml.rels")
|
94
|
+
parse_shared_strings
|
78
95
|
OOXMLDocumentObject.xmls_stack = []
|
79
96
|
OOXMLDocumentObject.root_subfolder = 'xl/'
|
80
|
-
self.shared_strings = nil
|
81
97
|
OOXMLDocumentObject.add_to_xmls_stack('xl/workbook.xml')
|
82
98
|
doc = Nokogiri::XML.parse(File.open(OOXMLDocumentObject.current_xml))
|
83
|
-
|
84
|
-
|
85
|
-
workbook.style_sheet = StyleSheet.new(parent: self).parse
|
99
|
+
@theme = PresentationTheme.parse("xl/#{link_to_theme_xml}") if link_to_theme_xml
|
100
|
+
@style_sheet = StyleSheet.new(parent: self).parse
|
86
101
|
doc.xpath('xmlns:workbook/xmlns:sheets/xmlns:sheet').each do |sheet|
|
87
|
-
file =
|
102
|
+
file = @relationships.target_by_id(sheet.attribute('id').value)
|
88
103
|
if file.start_with?('worksheets')
|
89
|
-
|
90
|
-
|
104
|
+
@worksheets << Worksheet.new(parent: self).parse(file)
|
105
|
+
@worksheets.last.name = sheet.attribute('name').value
|
91
106
|
elsif file.start_with?('chartsheets')
|
92
|
-
|
107
|
+
@worksheets << Chartsheet.new(parent: self).parse(file)
|
93
108
|
end
|
94
109
|
end
|
95
110
|
OOXMLDocumentObject.xmls_stack.pop
|
96
|
-
|
111
|
+
self
|
97
112
|
end
|
98
113
|
|
99
|
-
|
100
|
-
# @return [Array, Nokogiri::XML::Eelement] list of shared strings
|
101
|
-
attr_writer :shared_strings
|
102
|
-
attr_accessor :styles_node
|
114
|
+
private
|
103
115
|
|
104
|
-
|
105
|
-
|
106
|
-
if @shared_strings.nil?
|
107
|
-
shared_strings_file = "#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/sharedStrings.xml"
|
108
|
-
@shared_strings = Nokogiri::XML(File.open(shared_strings_file)).xpath('//xmlns:si') if File.exist?(shared_strings_file)
|
109
|
-
end
|
110
|
-
@shared_strings
|
111
|
-
end
|
112
|
-
|
113
|
-
def link_to_theme_xml
|
114
|
-
file = File.open(OOXMLDocumentObject.path_to_folder + 'xl/_rels/workbook.xml.rels')
|
115
|
-
relationships = Relationships.parse_rels(file)
|
116
|
-
relationships.target_by_type('theme')
|
117
|
-
end
|
116
|
+
def link_to_theme_xml
|
117
|
+
relationships.target_by_type('theme').first
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OoxmlParser
|
2
4
|
# Class for storing data of chartsheets files
|
3
5
|
class Chartsheet < OOXMLDocumentObject
|
@@ -11,7 +13,7 @@ module OoxmlParser
|
|
11
13
|
|
12
14
|
def parse(file)
|
13
15
|
OOXMLDocumentObject.add_to_xmls_stack(OOXMLDocumentObject.root_subfolder + file)
|
14
|
-
doc =
|
16
|
+
doc = parse_xml(OOXMLDocumentObject.current_xml)
|
15
17
|
node = doc.xpath('//xmlns:chartsheet').first
|
16
18
|
node.xpath('*').each do |node_child|
|
17
19
|
case node_child.name
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'shared_string_table/string_index'
|
4
|
+
module OoxmlParser
|
5
|
+
# Class for parsing shared string table
|
6
|
+
class SharedStringTable < OOXMLDocumentObject
|
7
|
+
# @return [Integer] count of shared strings
|
8
|
+
attr_reader :count
|
9
|
+
# @return [Integer] unique count of shared strings
|
10
|
+
attr_reader :unique_count
|
11
|
+
# @return [Array<StringIndex>] String Index
|
12
|
+
attr_reader :string_indexes
|
13
|
+
|
14
|
+
def initialize(parent: nil)
|
15
|
+
@string_indexes = []
|
16
|
+
@parent = parent
|
17
|
+
end
|
18
|
+
|
19
|
+
# Parse Shared string table file
|
20
|
+
# @param file [String] path to file
|
21
|
+
# @return [SharedStringTable]
|
22
|
+
def parse(file)
|
23
|
+
return nil unless File.exist?(file)
|
24
|
+
|
25
|
+
document = parse_xml(file)
|
26
|
+
node = document.xpath('*').first
|
27
|
+
|
28
|
+
node.attributes.each do |key, value|
|
29
|
+
case key
|
30
|
+
when 'count'
|
31
|
+
@count = value.value.to_i
|
32
|
+
when 'uniqueCount'
|
33
|
+
@unique_count = value.value.to_i
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
node.xpath('*').each do |node_child|
|
38
|
+
case node_child.name
|
39
|
+
when 'si'
|
40
|
+
@string_indexes << StringIndex.new(parent: self).parse(node_child)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
self
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table/string_index.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing string index `si` tag
|
5
|
+
class StringIndex < OOXMLDocumentObject
|
6
|
+
# @return [ParagraphRun] run of text
|
7
|
+
attr_reader :run
|
8
|
+
# @return [String] text
|
9
|
+
attr_reader :text
|
10
|
+
|
11
|
+
# Parse StringIndex data
|
12
|
+
# @param [Nokogiri::XML:Element] node with StringIndex data
|
13
|
+
# @return [StringIndex] value of StringIndex data
|
14
|
+
def parse(node)
|
15
|
+
node.xpath('*').each do |node_child|
|
16
|
+
case node_child.name
|
17
|
+
when 't'
|
18
|
+
@text = node_child.text
|
19
|
+
when 'r'
|
20
|
+
@run = ParagraphRun.new(parent: self).parse(node_child)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
self
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'style_sheet/cell_xfs'
|
1
4
|
require_relative 'style_sheet/fills'
|
2
5
|
require_relative 'style_sheet/fonts'
|
3
6
|
require_relative 'style_sheet/number_formats'
|
7
|
+
require_relative 'style_sheet/xlsx_borders'
|
4
8
|
module OoxmlParser
|
5
9
|
# Parsing file styles.xml
|
6
10
|
class StyleSheet < OOXMLDocumentObject
|
@@ -10,6 +14,10 @@ module OoxmlParser
|
|
10
14
|
attr_accessor :fonts
|
11
15
|
# @return [Fills] fills
|
12
16
|
attr_accessor :fills
|
17
|
+
# @return [CellXfs] Cell XFs
|
18
|
+
attr_reader :cell_xfs
|
19
|
+
# @return [XlsxBorders] Cell XFs
|
20
|
+
attr_reader :borders
|
13
21
|
|
14
22
|
def initialize(parent: nil)
|
15
23
|
@number_formats = NumberFormats.new(parent: self)
|
@@ -19,7 +27,7 @@ module OoxmlParser
|
|
19
27
|
end
|
20
28
|
|
21
29
|
def parse
|
22
|
-
doc =
|
30
|
+
doc = parse_xml("#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/styles.xml")
|
23
31
|
doc.root.xpath('*').each do |node_child|
|
24
32
|
case node_child.name
|
25
33
|
when 'numFmts'
|
@@ -28,6 +36,10 @@ module OoxmlParser
|
|
28
36
|
@fonts.parse(node_child)
|
29
37
|
when 'fills'
|
30
38
|
@fills.parse(node_child)
|
39
|
+
when 'cellXfs'
|
40
|
+
@cell_xfs = CellXfs.new(parent: self).parse(node_child)
|
41
|
+
when 'borders'
|
42
|
+
@borders = XlsxBorders.new(parent: self).parse(node_child)
|
31
43
|
end
|
32
44
|
end
|
33
45
|
self
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'cell_xfs/xf'
|
4
|
+
module OoxmlParser
|
5
|
+
# Class for parsing `cellXfs`
|
6
|
+
class CellXfs < OOXMLDocumentObject
|
7
|
+
# @return [Integer] count of cell xfs
|
8
|
+
attr_reader :count
|
9
|
+
# @return [Array<Xf>] list of xf's
|
10
|
+
attr_reader :xf_array
|
11
|
+
|
12
|
+
def initialize(parent: nil)
|
13
|
+
@xf_array = []
|
14
|
+
@parent = parent
|
15
|
+
end
|
16
|
+
|
17
|
+
# Parse CellXfs data
|
18
|
+
# @param [Nokogiri::XML:Element] node with CellXfs data
|
19
|
+
# @return [CellXfs] value of CellXfs data
|
20
|
+
def parse(node)
|
21
|
+
node.attributes.each do |key, value|
|
22
|
+
case key
|
23
|
+
when 'count'
|
24
|
+
@count = value.value.to_i
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
node.xpath('*').each do |node_child|
|
29
|
+
case node_child.name
|
30
|
+
when 'xf'
|
31
|
+
@xf_array << Xf.new(parent: self).parse(node_child)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
self
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'cell_style/alignment'
|
4
|
+
module OoxmlParser
|
5
|
+
# Class for parsing `xf` object
|
6
|
+
class Xf < OOXMLDocumentObject
|
7
|
+
ALL_FORMAT_VALUE = ['General',
|
8
|
+
'0',
|
9
|
+
'0.00',
|
10
|
+
'#,##0',
|
11
|
+
'#,##0.00',
|
12
|
+
'$#,##0_);($#,##0)',
|
13
|
+
'$#,##0_);[Red]($#,##0)',
|
14
|
+
'$#,##0.00_);($#,##0.00)',
|
15
|
+
'$#,##0.00_);[Red]($#,##0.00)',
|
16
|
+
'0%', '0.00%',
|
17
|
+
'0.00E+00',
|
18
|
+
'# ?/?',
|
19
|
+
'# ??/??',
|
20
|
+
'm/d/yyyy',
|
21
|
+
'd-mmm-yy',
|
22
|
+
'd-mmm',
|
23
|
+
'mmm-yy',
|
24
|
+
'h:mm AM/PM',
|
25
|
+
'h:mm:ss AM/PM',
|
26
|
+
'h:mm',
|
27
|
+
'h:mm:ss',
|
28
|
+
'm/d/yyyy h:mm',
|
29
|
+
nil,
|
30
|
+
nil,
|
31
|
+
nil,
|
32
|
+
nil,
|
33
|
+
nil,
|
34
|
+
nil,
|
35
|
+
nil,
|
36
|
+
nil,
|
37
|
+
nil,
|
38
|
+
nil,
|
39
|
+
nil,
|
40
|
+
nil,
|
41
|
+
nil,
|
42
|
+
nil,
|
43
|
+
'#,##0_);(#,##0)',
|
44
|
+
'#,##0_);[Red](#,##0)',
|
45
|
+
'#,##0.00_);(#,##0.00)',
|
46
|
+
'#,##0.00_);[Red](#,##0.00)',
|
47
|
+
nil,
|
48
|
+
nil,
|
49
|
+
nil,
|
50
|
+
nil,
|
51
|
+
'mm:ss',
|
52
|
+
'[h]:mm:ss',
|
53
|
+
'mm:ss.0',
|
54
|
+
'##0.0E+0',
|
55
|
+
'@'].freeze
|
56
|
+
|
57
|
+
attr_reader :alignment
|
58
|
+
# @return [True, False] check if style should add QuotePrefix (' symbol) to start of the string
|
59
|
+
attr_reader :quote_prefix
|
60
|
+
# @return [True, False] is font applied
|
61
|
+
attr_reader :apply_font
|
62
|
+
# @return [True, False] is border applied
|
63
|
+
attr_reader :apply_border
|
64
|
+
# @return [True, False] is fill applied
|
65
|
+
attr_reader :apply_fill
|
66
|
+
# @return [True, False] is number format applied
|
67
|
+
attr_reader :apply_number_format
|
68
|
+
# @return [True, False] is alignment applied
|
69
|
+
attr_reader :apply_alignment
|
70
|
+
# @return [Integer] id of font
|
71
|
+
attr_reader :font_id
|
72
|
+
# @return [Integer] id of border
|
73
|
+
attr_reader :border_id
|
74
|
+
# @return [Integer] id of fill
|
75
|
+
attr_reader :fill_id
|
76
|
+
# @return [Integer] id of number format
|
77
|
+
attr_reader :number_format_id
|
78
|
+
|
79
|
+
def initialize(parent: nil)
|
80
|
+
@numerical_format = 'General'
|
81
|
+
@alignment = XlsxAlignment.new
|
82
|
+
@parent = parent
|
83
|
+
end
|
84
|
+
|
85
|
+
# Parse Xf object
|
86
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
87
|
+
# @return [Xf] result of parsing
|
88
|
+
def parse(node)
|
89
|
+
node.attributes.each do |key, value|
|
90
|
+
case key
|
91
|
+
when 'applyFont'
|
92
|
+
@apply_font = attribute_enabled?(value)
|
93
|
+
when 'applyBorder'
|
94
|
+
@apply_border = attribute_enabled?(value)
|
95
|
+
when 'applyFill'
|
96
|
+
@apply_fill = attribute_enabled?(value)
|
97
|
+
when 'applyNumberFormat'
|
98
|
+
@apply_number_format = attribute_enabled?(value)
|
99
|
+
when 'applyAlignment'
|
100
|
+
@apply_alignment = attribute_enabled?(value)
|
101
|
+
when 'fontId'
|
102
|
+
@font_id = value.value.to_i
|
103
|
+
when 'borderId'
|
104
|
+
@border_id = value.value.to_i
|
105
|
+
when 'fillId'
|
106
|
+
@fill_id = value.value.to_i
|
107
|
+
when 'numFmtId'
|
108
|
+
@number_format_id = value.value.to_i
|
109
|
+
when 'quotePrefix'
|
110
|
+
@quote_prefix = attribute_enabled?(value)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
node.xpath('*').each do |node_child|
|
114
|
+
case node_child.name
|
115
|
+
when 'alignment'
|
116
|
+
@alignment.parse(node_child) if @apply_alignment
|
117
|
+
end
|
118
|
+
end
|
119
|
+
self
|
120
|
+
end
|
121
|
+
|
122
|
+
def font
|
123
|
+
root_object.style_sheet.fonts[@font_id]
|
124
|
+
end
|
125
|
+
|
126
|
+
def borders
|
127
|
+
root_object.style_sheet.borders.borders_array[@border_id] if @apply_border
|
128
|
+
end
|
129
|
+
|
130
|
+
def fill_color
|
131
|
+
root_object.style_sheet.fills[@fill_id] if @apply_fill
|
132
|
+
end
|
133
|
+
|
134
|
+
def numerical_format
|
135
|
+
return @numerical_format unless @apply_number_format
|
136
|
+
|
137
|
+
format = root_object.style_sheet.number_formats.format_by_id(@number_format_id)
|
138
|
+
if format
|
139
|
+
format.format_code
|
140
|
+
else
|
141
|
+
ALL_FORMAT_VALUE[@number_format_id]
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|