ooxml_parser 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.overcommit.yml +35 -0
- data/Changelog.md +25 -0
- data/LICENSE.txt +661 -0
- data/README.md +26 -0
- data/circle.yml +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alingment.rb +56 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +123 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_point.rb +11 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_style/office_2007_chart_style.rb +17 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_style/office_2010_chart_style.rb +17 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +49 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +11 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +39 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +32 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/group/docx_group_element.rb +10 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/group/docx_grouped_drawing.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +25 -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 +16 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +37 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_gradient_color.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_single_gradient_color.rb +6 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/solid_color/docx_solid_color.rb +10 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_element.rb +10 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb +44 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +43 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +54 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +40 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end/line_size.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +21 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_style/docx_shape_style.rb +5 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_element.rb +10 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_properties.rb +6 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +24 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +24 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/common_non_visual_properties.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/non_visual_properties.rb +19 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/non_visual_shape_properties.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape.rb +28 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_placeholder.rb +18 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/ooxml_shift.rb +15 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/transform_effect.rb +28 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties.rb +13 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/ooxml_text_box.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/text_body.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +58 -0
- data/lib/ooxml_parser/common_parser/common_data/color.rb +473 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb +14 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +21 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +150 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/image/fill_rectangle.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/image/stretching.rb +11 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +32 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/image_properties.rb +16 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +15 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +10 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +14 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +21 -0
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +127 -0
- data/lib/ooxml_parser/common_parser/common_data/font_style.rb +101 -0
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +53 -0
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +87 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +48 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/strikeout.rb +16 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +79 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +24 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering/numbering_properties/numbering_level.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering/numbering_properties.rb +69 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering.rb +18 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +115 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +47 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_cell_margin.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +43 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +49 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +83 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_elements.rb +21 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/whole_table/line_join.rb +19 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/whole_table/table_cell_style.rb +20 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +43 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +142 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb +18 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +125 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +9 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +77 -0
- data/lib/ooxml_parser/common_parser/common_data/table.rb +41 -0
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +40 -0
- data/lib/ooxml_parser/common_parser/common_document_structure.rb +7 -0
- data/lib/ooxml_parser/configuration.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb +28 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +10 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +21 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +70 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +11 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +10 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +11 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +12 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +11 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +11 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +13 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +12 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +12 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +10 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +10 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/operator.rb +13 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +11 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +203 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/offset.rb +10 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shadow.rb +10 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_margins.rb +11 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_size.rb +10 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/stroke.rb +10 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties.rb +16 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +40 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +13 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +388 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +46 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +87 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/bookmark.rb +10 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/paragraph_tab.rb +19 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb +35 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb +56 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +324 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +37 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/image.rb +15 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +10 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +37 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +29 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +49 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +42 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +88 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/size.rb +84 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +232 -0
- data/lib/ooxml_parser/docx_parser/docx_parser.rb +16 -0
- data/lib/ooxml_parser/helpers/string_helper.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb +25 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment.rb +31 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +40 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +44 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +19 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +34 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +25 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +23 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/shape_properties/extents.rb +10 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/shape_properties/offset.rb +10 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/text_body/paragraph.rb +10 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/text_body/text_field.rb +18 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shapes_grouping/shapes_grouping.rb +9 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping/grouping_properties.rb +16 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +30 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +28 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +31 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +20 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition.rb +26 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +33 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +52 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +23 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/sound_action/sound/sound.rb +18 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/sound_action/sound_action.rb +18 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +43 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +9 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +110 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +20 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +62 -0
- data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +15 -0
- data/lib/ooxml_parser/version.rb +6 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character/excel_comment_character_properties.rb +27 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character.rb +25 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +20 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb +21 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +23 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +18 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +24 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position/xlsx_drawing_position_parameters.rb +22 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position.rb +22 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +49 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb +30 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/foreground_color.rb +25 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/ooxml_font.rb +38 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style.rb +95 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +47 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +19 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_table.rb +30 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +74 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +108 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +15 -0
- data/lib/ooxml_parser.rb +35 -0
- data/ooxml_parser.gemspec +30 -0
- metadata +310 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class GroupingProperties
|
3
|
+
attr_accessor :transform
|
4
|
+
|
5
|
+
def self.parse(grouping_properties_node)
|
6
|
+
grouping_properties = GroupingProperties.new
|
7
|
+
grouping_properties_node.xpath('*').each do |grouping_property_node|
|
8
|
+
case grouping_property_node.name
|
9
|
+
when 'xfrm'
|
10
|
+
grouping_properties.transform = TransformEffect.parse(grouping_property_node)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
grouping_properties
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative 'shapes_grouping/grouping_properties'
|
2
|
+
module OoxmlParser
|
3
|
+
class ShapesGrouping
|
4
|
+
attr_accessor :elements, :properties
|
5
|
+
|
6
|
+
def initialize(elements = [])
|
7
|
+
@elements = elements
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.parse(grouping_node)
|
11
|
+
grouping = ShapesGrouping.new
|
12
|
+
grouping_node.xpath('*').each do |grouping_node_child|
|
13
|
+
case grouping_node_child.name
|
14
|
+
when 'nvGrpSpPr'
|
15
|
+
when 'grpSpPr'
|
16
|
+
grouping.properties = GroupingProperties.parse(grouping_node_child)
|
17
|
+
when 'pic'
|
18
|
+
grouping.elements << DocxPicture.parse(grouping_node_child)
|
19
|
+
when 'sp'
|
20
|
+
grouping.elements << PresentationShape.parse(grouping_node_child).dup
|
21
|
+
when 'grpSp'
|
22
|
+
grouping.elements << parse(grouping_node_child)
|
23
|
+
when 'graphicFrame'
|
24
|
+
grouping.elements << GraphicFrame.parse(grouping_node_child)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
grouping
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class AnimationEffect
|
3
|
+
attr_accessor :transition, :filter, :behavior
|
4
|
+
|
5
|
+
def initialize(behavior = nil)
|
6
|
+
@behavior = behavior
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.parse(animation_effect_node)
|
10
|
+
animation_effect = AnimationEffect.new
|
11
|
+
animation_effect.transition = animation_effect_node.attribute('transition').value
|
12
|
+
animation_effect.filter = animation_effect_node.attribute('filter').value
|
13
|
+
animation_effect_node.xpath('*').each do |animation_effect_node_child|
|
14
|
+
case animation_effect_node_child.name
|
15
|
+
when 'cBhvr'
|
16
|
+
animation_effect.behavior = Behavior.parse(animation_effect_node_child)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
animation_effect
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class Behavior
|
3
|
+
attr_accessor :common_time_node, :attribute_name_list, :target
|
4
|
+
|
5
|
+
def initialize(common_time_node = nil, attribute_name_list = [], target = nil)
|
6
|
+
@common_time_node = common_time_node
|
7
|
+
@attribute_name_list = attribute_name_list
|
8
|
+
@target = target
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.parse(behavior_node)
|
12
|
+
behavior = Behavior.new
|
13
|
+
behavior_node.xpath('*').each do |behavior_node_child|
|
14
|
+
case behavior_node_child.name
|
15
|
+
when 'cTn'
|
16
|
+
behavior.common_time_node = CommonTiming.parse(behavior_node_child)
|
17
|
+
when 'tgtEl'
|
18
|
+
behavior.target = TargetElement.parse(behavior_node_child)
|
19
|
+
when 'attrNameLst'
|
20
|
+
behavior_node_child.xpath('p:attrName').each do |attribute_name_node|
|
21
|
+
behavior.attribute_name_list << attribute_name_node.text
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
behavior
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class TargetElement
|
3
|
+
attr_accessor :type, :id, :name, :built_in
|
4
|
+
|
5
|
+
def initialize(type = '', id = '')
|
6
|
+
@type = type
|
7
|
+
@id = id
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.parse(target_node)
|
11
|
+
target = TargetElement.new
|
12
|
+
target_node.xpath('*').each do |target_node_child|
|
13
|
+
case target_node_child.name
|
14
|
+
when 'sldTgt'
|
15
|
+
target.type = :slide
|
16
|
+
when 'sndTgt'
|
17
|
+
target.type = :sound
|
18
|
+
target.name = target_node_child.attribute('name').value
|
19
|
+
target.built_in = target_node_child.attribute('builtIn').value ? StringHelper.to_bool(target_node_child.attribute('builtIn').value) : false
|
20
|
+
when 'spTgt'
|
21
|
+
target.type = :shape
|
22
|
+
target.id = target_node_child.attribute('spid').value
|
23
|
+
when 'inkTgt'
|
24
|
+
target.type = :ink
|
25
|
+
target.id = target_node_child.attribute('spid').value
|
26
|
+
end
|
27
|
+
end
|
28
|
+
target
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class SetTimeNode
|
3
|
+
attr_accessor :behavior, :to
|
4
|
+
|
5
|
+
def initialize(behavior = nil)
|
6
|
+
@behavior = behavior
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.parse(set_time_node)
|
10
|
+
set_time = SetTimeNode.new
|
11
|
+
set_time_node.xpath('*').each do |set_time_node_child|
|
12
|
+
case set_time_node_child.name
|
13
|
+
when 'cBhvr'
|
14
|
+
set_time.behavior = Behavior.parse(set_time_node_child)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
set_time
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class Condition
|
3
|
+
attr_accessor :event, :delay, :duration
|
4
|
+
|
5
|
+
def initialize(event = nil, delay = nil, duration = nil)
|
6
|
+
@event = event
|
7
|
+
@delay = delay
|
8
|
+
@duration = duration
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.parse(condition_node)
|
12
|
+
condition = Condition.new
|
13
|
+
condition.event = condition_node.attribute('evt').value
|
14
|
+
condition.delay = condition_node.attribute('delay').value
|
15
|
+
condition
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.parse_list(conditions_list_node)
|
19
|
+
conditions = []
|
20
|
+
conditions_list_node.xpath('p:cond').each do |condition_node|
|
21
|
+
conditions << Condition.parse(condition_node)
|
22
|
+
end
|
23
|
+
conditions
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative 'common_timing/condition'
|
2
|
+
module OoxmlParser
|
3
|
+
class CommonTiming
|
4
|
+
attr_accessor :id, :duration, :restart, :children, :start_conditions, :end_conditions
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@id = nil
|
8
|
+
@duration = nil
|
9
|
+
@restart = nil
|
10
|
+
@children = []
|
11
|
+
@start_conditions = []
|
12
|
+
@end_conditions = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.parse(common_time_node)
|
16
|
+
common_timing = CommonTiming.new
|
17
|
+
common_timing.duration = common_time_node.attribute('dur').value unless common_time_node.attribute('dur').nil?
|
18
|
+
common_timing.restart = common_time_node.attribute('restart').value unless common_time_node.attribute('restart').nil?
|
19
|
+
common_timing.id = common_time_node.attribute('id').value
|
20
|
+
common_time_node.xpath('*').each do |common_time_node_child|
|
21
|
+
case common_time_node_child.name
|
22
|
+
when 'stCondLst'
|
23
|
+
common_timing.start_conditions = Condition.parse_list(common_time_node_child)
|
24
|
+
when 'endCondLst'
|
25
|
+
common_timing.end_conditions = Condition.parse_list(common_time_node_child)
|
26
|
+
when 'childTnLst'
|
27
|
+
common_timing.children = TimeNode.parse_list(common_time_node_child)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
common_timing
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require_relative 'time_node/common_timing'
|
2
|
+
module OoxmlParser
|
3
|
+
class TimeNode
|
4
|
+
attr_accessor :type, :common_time_node, :previous_conditions_list, :next_conditions_list
|
5
|
+
|
6
|
+
def initialize(type = nil, common_time_node = nil, previous_conditions_list = [], next_conditions_list = [])
|
7
|
+
@type = type
|
8
|
+
@common_time_node = common_time_node
|
9
|
+
@previous_conditions_list = previous_conditions_list
|
10
|
+
@next_conditions_list = next_conditions_list
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.parse(time_node, type)
|
14
|
+
time = TimeNode.new
|
15
|
+
time.type = type
|
16
|
+
time_node.xpath('*').each do |time_node_child|
|
17
|
+
case time_node_child.name
|
18
|
+
when 'cTn'
|
19
|
+
time.common_time_node = CommonTiming.parse(time_node_child)
|
20
|
+
when 'prevCondLst'
|
21
|
+
time.previous_conditions_list = Condition.parse_list(time_node_child)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
time
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.parse_list(timing_list_node)
|
28
|
+
timings = []
|
29
|
+
timing_list_node.xpath('*').each do |time_node|
|
30
|
+
case time_node.name
|
31
|
+
when 'par'
|
32
|
+
timings << TimeNode.parse(time_node, :parallel)
|
33
|
+
when 'seq'
|
34
|
+
timings << TimeNode.parse(time_node, :sequence)
|
35
|
+
when 'excl'
|
36
|
+
timings << TimeNode.parse(time_node, :exclusive)
|
37
|
+
when 'anim'
|
38
|
+
timings << TimeNode.parse(time_node, :animate)
|
39
|
+
when 'set'
|
40
|
+
timings << SetTimeNode.parse(time_node)
|
41
|
+
when 'animEffect'
|
42
|
+
timings << AnimationEffect.parse(time_node)
|
43
|
+
when 'video'
|
44
|
+
timings << :video
|
45
|
+
when 'audio'
|
46
|
+
timings << :audio
|
47
|
+
end
|
48
|
+
end
|
49
|
+
timings
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'timing/time_node'
|
2
|
+
module OoxmlParser
|
3
|
+
class Timing
|
4
|
+
attr_accessor :time_node_list, :build_list, :extension_list
|
5
|
+
|
6
|
+
def initialize(time_node_list = [], build_list = [], extension_list = [])
|
7
|
+
@time_node_list = time_node_list
|
8
|
+
@build_list = build_list
|
9
|
+
@extension_list = extension_list
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.parse(timing_node)
|
13
|
+
timing = Timing.new
|
14
|
+
timing_node.xpath('*').each do |timing_node_child|
|
15
|
+
case timing_node_child.name
|
16
|
+
when 'tnLst'
|
17
|
+
timing.time_node_list = TimeNode.parse_list(timing_node_child)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
timing
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class Sound < OOXMLDocumentObject
|
3
|
+
attr_accessor :path, :name
|
4
|
+
|
5
|
+
def initialize(path = '', name = '')
|
6
|
+
@path = path
|
7
|
+
@name = name
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.parse(sound_node)
|
11
|
+
sound = Sound.new
|
12
|
+
path_to_original_file = dir + OOXMLDocumentObject.get_link_from_rels(sound_node.attribute('embed').value)
|
13
|
+
sound.path = FileHelper.copy_file(path_to_original_file, "#{DEFAULT_DIRECTORY_FOR_MEDIA}/media_from_#{File.basename(OOXMLDocumentObject.path_to_folder)}/")
|
14
|
+
sound.name = sound_node.attribute('name').value
|
15
|
+
sound
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class SoundAction
|
3
|
+
attr_accessor :start_sound, :end_sound
|
4
|
+
|
5
|
+
def self.parse(sound_action_node)
|
6
|
+
sound_action = SoundAction.new
|
7
|
+
sound_action_node.xpath('*').each do |sound_action_node_child|
|
8
|
+
case sound_action_node_child.name
|
9
|
+
when 'stSnd'
|
10
|
+
sound_action.start_sound = Sound.parse(sound_action_node_child.xpath('p:snd').first) unless sound_action_node_child.xpath('p:snd').first.nil?
|
11
|
+
when 'endSnd'
|
12
|
+
sound_action.end_sound = Sound.parse(sound_action_node_child.xpath('p:snd').first) unless sound_action_node_child.xpath('p:snd').first.nil?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
sound_action
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative 'transition_properties/transition_properties'
|
2
|
+
module OoxmlParser
|
3
|
+
class Transition < OOXMLDocumentObject
|
4
|
+
attr_accessor :speed, :properties, :sound_action, :advance_on_click, :delay, :duration
|
5
|
+
|
6
|
+
def initialize(properties = TransitionProperties.new)
|
7
|
+
@properties = properties
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.parse(transition_node)
|
11
|
+
transition = Transition.new
|
12
|
+
transition_node.xpath('*').each do |transition_node_child|
|
13
|
+
transition.properties.type = transition_node_child.name.to_sym
|
14
|
+
case transition_node_child.name
|
15
|
+
when 'blinds', 'checker', 'comb', 'cover', 'pull', 'push', 'randomBar', 'strips', 'wipe', 'zoom', 'warp'
|
16
|
+
transition.properties.direction = Alignment.parse(transition_node_child.attribute('dir'))
|
17
|
+
when 'cut', 'fade'
|
18
|
+
transition.properties.through_black = OOXMLDocumentObject.option_enabled?(transition_node_child, 'thruBlk')
|
19
|
+
when 'split'
|
20
|
+
transition.properties.direction = Alignment.parse(transition_node_child.attribute('dir'))
|
21
|
+
transition.properties.orientation = transition_node_child.attribute('orient').value.to_sym if transition_node_child.attribute('orient').value
|
22
|
+
when 'wheel', 'wheelReverse'
|
23
|
+
transition.properties.spokes = OOXMLDocumentObject.option_enabled?(transition_node_child, 'spokes')
|
24
|
+
when 'sndAc'
|
25
|
+
transition.sound_action = SoundAction.parse(transition_node_child)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
transition_node.attributes.each do |key, value|
|
29
|
+
case key
|
30
|
+
when 'spd'
|
31
|
+
transition.speed = value.value.to_sym
|
32
|
+
when 'advClick'
|
33
|
+
transition.advance_on_click = OOXMLDocumentObject.option_enabled?(transition_node, key)
|
34
|
+
when 'advTm'
|
35
|
+
transition.delay = value.value.to_f / 1_000.0
|
36
|
+
when 'dur'
|
37
|
+
transition.duration = value.value.to_f / 1_000.0
|
38
|
+
end
|
39
|
+
end
|
40
|
+
transition
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require_relative 'slide/presentation_alternate_content'
|
2
|
+
require_relative 'slide/background'
|
3
|
+
require_relative 'slide/graphic_frame/graphic_frame'
|
4
|
+
require_relative 'slide/slide/shapes_grouping'
|
5
|
+
require_relative 'slide/slide/timing'
|
6
|
+
module OoxmlParser
|
7
|
+
class Slide < OOXMLDocumentObject
|
8
|
+
attr_accessor :elements, :background, :transition, :timing, :alternate_content
|
9
|
+
|
10
|
+
def initialize(elements = [], background = nil)
|
11
|
+
@elements = elements
|
12
|
+
@background = background
|
13
|
+
end
|
14
|
+
|
15
|
+
def nonempty_elements
|
16
|
+
@elements.select { |cur_shape| !cur_shape.text_body.paragraphs.first.characters.empty? }
|
17
|
+
end
|
18
|
+
|
19
|
+
def graphic_frames
|
20
|
+
@elements.select { |cur_element| cur_element.is_a?(GraphicFrame) }
|
21
|
+
end
|
22
|
+
|
23
|
+
def content_horizontal_align(object, slide_size)
|
24
|
+
transform = nil
|
25
|
+
case object
|
26
|
+
when :image
|
27
|
+
transform = elements.find { |e| e.is_a? Picture }.properties.transform
|
28
|
+
when :chart
|
29
|
+
transform = elements.find { |e| e.is_a? GraphicFrame }.transform
|
30
|
+
when :table
|
31
|
+
transform = elements.find { |e| e.is_a? GraphicFrame }.transform
|
32
|
+
when :shape
|
33
|
+
transform = elements.find { |e| !e.shape_properties.preset.nil? }.shape_properties.transform
|
34
|
+
else
|
35
|
+
raise "Dont know this type object - #{object}"
|
36
|
+
end
|
37
|
+
return :left if transform.offset.x == 0
|
38
|
+
return :center if ((slide_size.width / 2) - (transform.extents.x / 2)).round(1) == transform.offset.x.round(1)
|
39
|
+
return :right if (slide_size.width - transform.extents.x).round(1) == transform.offset.x.round(1)
|
40
|
+
:unknown
|
41
|
+
end
|
42
|
+
|
43
|
+
def content_vertical_align(object, slide_size)
|
44
|
+
transform = nil
|
45
|
+
case object
|
46
|
+
when :image
|
47
|
+
transform = elements.find { |e| e.is_a? Picture }.properties.transform
|
48
|
+
when :chart
|
49
|
+
transform = elements.find { |e| e.is_a? GraphicFrame }.transform
|
50
|
+
when :table
|
51
|
+
transform = elements.find { |e| e.is_a? GraphicFrame }.transform
|
52
|
+
when :shape
|
53
|
+
transform = elements.find { |e| !e.shape_properties.preset.nil? }.shape_properties.transform
|
54
|
+
else
|
55
|
+
raise "Dont know this type object - #{object}"
|
56
|
+
end
|
57
|
+
return :top if transform.offset.y == 0
|
58
|
+
return :middle if ((slide_size.height / 2) - (transform.extents.y / 2)).round(1) == transform.offset.y.round(1)
|
59
|
+
return :bottom if (slide_size.height - transform.extents.y).round(1) == transform.offset.y.round(1)
|
60
|
+
:unknown
|
61
|
+
end
|
62
|
+
|
63
|
+
def content_distribute(object, slide_size)
|
64
|
+
return [:horizontally, :vertically] if content_horizontal_align(object, slide_size) == :center && content_vertical_align(object, slide_size) == :middle
|
65
|
+
return [:horizontally] if content_horizontal_align(object, slide_size) == :center
|
66
|
+
return [:vertically] if content_vertical_align(object, slide_size) == :middle
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.parse(path_to_slide_xml)
|
70
|
+
slide = Slide.new
|
71
|
+
OOXMLDocumentObject.add_to_xmls_stack(path_to_slide_xml)
|
72
|
+
doc = Nokogiri::XML(File.open(OOXMLDocumentObject.current_xml))
|
73
|
+
doc.xpath('//p:sld/*').each do |slide_node_child|
|
74
|
+
case slide_node_child.name
|
75
|
+
when 'cSld'
|
76
|
+
slide_node_child.xpath('*').each do |common_slide_node_child|
|
77
|
+
case common_slide_node_child.name
|
78
|
+
when 'spTree'
|
79
|
+
common_slide_node_child.xpath('*').each do |slide_element_node|
|
80
|
+
case slide_element_node.name
|
81
|
+
when 'nvGrpSpPr'
|
82
|
+
when 'grpSpPr'
|
83
|
+
when 'sp'
|
84
|
+
slide.elements << PresentationShape.parse(slide_element_node).dup
|
85
|
+
when 'pic'
|
86
|
+
slide.elements << DocxPicture.parse(slide_element_node)
|
87
|
+
when 'graphicFrame'
|
88
|
+
slide.elements << GraphicFrame.parse(slide_element_node)
|
89
|
+
when 'grpSp'
|
90
|
+
slide.elements << ShapesGrouping.parse(slide_element_node)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
when 'bg'
|
94
|
+
slide.background = Background.parse(common_slide_node_child)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
when 'clrMapOvr'
|
98
|
+
when 'timing'
|
99
|
+
slide.timing = Timing.parse(slide_node_child)
|
100
|
+
when 'transition'
|
101
|
+
slide.transition = Transition.parse(slide_node_child)
|
102
|
+
when 'AlternateContent'
|
103
|
+
slide.alternate_content = PresentationAlternateContent.parse(slide_node_child)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
OOXMLDocumentObject.xmls_stack.pop
|
107
|
+
slide
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class SlideSize
|
3
|
+
attr_accessor :width, :height, :type
|
4
|
+
|
5
|
+
def self.parse(slide_size_node)
|
6
|
+
slide_size = SlideSize.new
|
7
|
+
slide_size_node.attributes.each do |key, value|
|
8
|
+
case key
|
9
|
+
when 'cx'
|
10
|
+
slide_size.width = (value.value.to_f / OoxmlParser.configuration.units_delimiter).round(2)
|
11
|
+
when 'cy'
|
12
|
+
slide_size.height = (value.value.to_f / OoxmlParser.configuration.units_delimiter).round(2)
|
13
|
+
when 'type'
|
14
|
+
slide_size.type = value.value.to_sym
|
15
|
+
end
|
16
|
+
end
|
17
|
+
slide_size
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require_relative 'presentation/presentation_comment'
|
2
|
+
require_relative 'presentation/presentation_theme'
|
3
|
+
require_relative 'presentation/slide'
|
4
|
+
require_relative 'presentation/slide_size'
|
5
|
+
module OoxmlParser
|
6
|
+
class Presentation < CommonDocumentStructure
|
7
|
+
attr_accessor :slides, :theme, :slide_size, :comments
|
8
|
+
|
9
|
+
def initialize(slides = [], theme = nil, comments = [])
|
10
|
+
@slides = slides
|
11
|
+
@theme = theme
|
12
|
+
@comments = comments
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.parse(path_to_folder)
|
16
|
+
OOXMLDocumentObject.path_to_folder = path_to_folder
|
17
|
+
OOXMLDocumentObject.root_subfolder = 'ppt/'
|
18
|
+
OOXMLDocumentObject.xmls_stack = []
|
19
|
+
OOXMLDocumentObject.namespace_prefix = 'a'
|
20
|
+
OOXMLDocumentObject.add_to_xmls_stack('ppt/presentation.xml')
|
21
|
+
doc = Nokogiri::XML(File.open(OOXMLDocumentObject.current_xml))
|
22
|
+
presentation = Presentation.new
|
23
|
+
presentation.theme = PresentationTheme.parse('ppt/theme/theme1.xml')
|
24
|
+
presentation_node = doc.search('//p:presentation').first
|
25
|
+
presentation_node.xpath('*').each do |presentation_node_child|
|
26
|
+
case presentation_node_child.name
|
27
|
+
when 'sldSz'
|
28
|
+
presentation.slide_size = SlideSize.parse(presentation_node_child)
|
29
|
+
when 'sldIdLst'
|
30
|
+
presentation_node_child.xpath('p:sldId').each do |silde_id_node|
|
31
|
+
id = nil
|
32
|
+
silde_id_node.attribute_nodes.select { |node| id = node.to_s if node.namespace && node.namespace.prefix == 'r' }
|
33
|
+
presentation.slides << Slide.parse("#{OOXMLDocumentObject.root_subfolder}/#{OOXMLDocumentObject.get_link_from_rels(id)}")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
presentation.comments = PresentationComment.parse_list
|
38
|
+
OOXMLDocumentObject.xmls_stack.pop
|
39
|
+
presentation
|
40
|
+
end
|
41
|
+
|
42
|
+
class << self
|
43
|
+
# @return [FontStyle] current font_style
|
44
|
+
attr_accessor :current_font_style
|
45
|
+
|
46
|
+
def current_font_style
|
47
|
+
@current_font_style = FontStyle.new if @current_font_style.nil?
|
48
|
+
@current_font_style
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [String] default_font_typeface
|
52
|
+
def default_font_typeface
|
53
|
+
'Arial'
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [FixNum] default_font_typeface
|
57
|
+
def default_font_size
|
58
|
+
18
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative 'pptx_data/presentation.rb'
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
class PptxParser
|
5
|
+
def self.parse_pptx(path_to_file)
|
6
|
+
path_to_zip_file = OOXMLDocumentObject.copy_file_and_rename_to_zip(path_to_file)
|
7
|
+
OOXMLDocumentObject.unzip_file(path_to_zip_file, path_to_zip_file.sub(File.basename(path_to_zip_file), ''))
|
8
|
+
OOXMLDocumentObject.path_to_folder = path_to_zip_file.sub(File.basename(path_to_zip_file), '')
|
9
|
+
pptx_model = Presentation.parse(OOXMLDocumentObject.path_to_folder)
|
10
|
+
pptx_model.file_path = path_to_file
|
11
|
+
FileUtils.remove_dir(OOXMLDocumentObject.path_to_folder)
|
12
|
+
pptx_model
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Properties of XLSX comment Character (Run)
|
2
|
+
module OoxmlParser
|
3
|
+
class ExcelCommentCharacterProperties < OOXMLDocumentObject
|
4
|
+
attr_accessor :size, :color, :font
|
5
|
+
|
6
|
+
def initialize(size = '', color = nil, font = '')
|
7
|
+
@size = size
|
8
|
+
@color = color
|
9
|
+
@font = font
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.parse(properties_node)
|
13
|
+
character_properties = ExcelCommentCharacterProperties.new
|
14
|
+
properties_node.xpath('*').each do |properties_node_child|
|
15
|
+
case properties_node_child.name
|
16
|
+
when 'sz'
|
17
|
+
character_properties.size = properties_node_child.attribute('val').value
|
18
|
+
when 'color'
|
19
|
+
character_properties.color = Color.parse_color_tag(properties_node_child)
|
20
|
+
when 'rFont'
|
21
|
+
character_properties.font = properties_node_child.attribute('val').value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
character_properties
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative 'excel_comment_character/excel_comment_character_properties'
|
2
|
+
# Single Properties Character (Run) of XLSX comment
|
3
|
+
module OoxmlParser
|
4
|
+
class ExcelCommentCharacter
|
5
|
+
attr_accessor :properties, :text
|
6
|
+
|
7
|
+
def initialize(properties = nil, text = '')
|
8
|
+
@properties = properties
|
9
|
+
@text = text
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.parse(character_node)
|
13
|
+
character = ExcelCommentCharacter.new
|
14
|
+
character_node.xpath('*').each do |character_node_child|
|
15
|
+
case character_node_child.name
|
16
|
+
when 'rPr'
|
17
|
+
character.properties = ExcelCommentCharacterProperties.parse(character_node_child)
|
18
|
+
when 't'
|
19
|
+
character.text = character_node_child.text
|
20
|
+
end
|
21
|
+
end
|
22
|
+
character
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|