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
data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative 'shape/docx_shape'
|
2
|
+
require_relative 'group/docx_grouped_drawing'
|
3
|
+
require_relative 'picture/docx_picture'
|
4
|
+
# Docx Graphic Data
|
5
|
+
module OoxmlParser
|
6
|
+
class DocxGraphic < OOXMLDocumentObject
|
7
|
+
attr_accessor :type, :data
|
8
|
+
|
9
|
+
alias chart data
|
10
|
+
|
11
|
+
def self.parse(graphic_node)
|
12
|
+
graphic = DocxGraphic.new
|
13
|
+
graphic_node.xpath('a:graphicData/*', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').each do |graphic_data_node_child|
|
14
|
+
case graphic_data_node_child.name
|
15
|
+
when 'wsp'
|
16
|
+
graphic.type = :shape
|
17
|
+
graphic.data = DocxShape.parse(graphic_data_node_child)
|
18
|
+
when 'pic'
|
19
|
+
graphic.type = :picture
|
20
|
+
graphic.data = DocxPicture.parse(graphic_data_node_child)
|
21
|
+
when 'chart'
|
22
|
+
graphic.type = :chart
|
23
|
+
OOXMLDocumentObject.add_to_xmls_stack("#{OOXMLDocumentObject.root_subfolder}/#{OOXMLDocumentObject.get_link_from_rels(graphic_data_node_child.attribute('id').value)}")
|
24
|
+
graphic.data = Chart.parse
|
25
|
+
OOXMLDocumentObject.xmls_stack.pop
|
26
|
+
when 'wgp'
|
27
|
+
graphic.type = :group
|
28
|
+
graphic.data = DocxGroupedDrawing.parse(graphic_data_node_child)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
graphic
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative 'docx_group_element'
|
2
|
+
# Docx Groping Drawing Data
|
3
|
+
module OoxmlParser
|
4
|
+
class DocxGroupedDrawing < OOXMLDocumentObject
|
5
|
+
attr_accessor :elements, :properties
|
6
|
+
|
7
|
+
def initialize(elements = [])
|
8
|
+
@elements = elements
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.parse(grouping_node)
|
12
|
+
grouping = DocxGroupedDrawing.new
|
13
|
+
grouping_node.xpath('*').each do |grouping_node_child|
|
14
|
+
case grouping_node_child.name
|
15
|
+
when 'grpSpPr'
|
16
|
+
grouping.properties = DocxShapeProperties.parse(grouping_node_child)
|
17
|
+
when 'cNvGrpSpPr'
|
18
|
+
when 'pic'
|
19
|
+
element = DocxGroupElement.new(:picture)
|
20
|
+
element.object = DocxPicture.parse(grouping_node_child)
|
21
|
+
grouping.elements << element
|
22
|
+
when 'wsp'
|
23
|
+
element = DocxGroupElement.new(:shape)
|
24
|
+
element.object = DocxShape.parse(grouping_node_child)
|
25
|
+
grouping.elements << element
|
26
|
+
when 'grpSp'
|
27
|
+
element = parse(grouping_node_child)
|
28
|
+
grouping.elements << element
|
29
|
+
end
|
30
|
+
end
|
31
|
+
grouping
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# DOCX Blip properties
|
2
|
+
module OoxmlParser
|
3
|
+
class DocxBlip < OOXMLDocumentObject
|
4
|
+
attr_accessor :path_to_media_file, :alpha_channel
|
5
|
+
|
6
|
+
alias path path_to_media_file
|
7
|
+
|
8
|
+
def to_str
|
9
|
+
path_to_media_file
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.parse(blip_fill_node)
|
13
|
+
blip = DocxBlip.new
|
14
|
+
blip_node = blip_fill_node.xpath('a:blip', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').first
|
15
|
+
path_to_media_file = OOXMLDocumentObject.get_link_from_rels(blip_node.attribute('embed').value)
|
16
|
+
raise LoadError, "Cant find path to media file by id: #{blip_node.attribute('embed').value}" if path_to_media_file.empty?
|
17
|
+
blip_node.xpath('*').each do |blip_node_child|
|
18
|
+
case blip_node_child.name
|
19
|
+
when 'alphaModFix'
|
20
|
+
blip.alpha_channel = (blip_node_child.attribute('amt').value.to_f / 1_000.0).round(0).to_f
|
21
|
+
end
|
22
|
+
end
|
23
|
+
blip.path_to_media_file = OOXMLDocumentObject.copy_media_file("#{OOXMLDocumentObject.root_subfolder}/#{path_to_media_file.gsub('..', '')}")
|
24
|
+
blip
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative 'docx_blip'
|
2
|
+
# Docx Picture Data
|
3
|
+
module OoxmlParser
|
4
|
+
class DocxPicture
|
5
|
+
attr_accessor :path_to_image, :properties, :nonvisual_properties, :chart
|
6
|
+
|
7
|
+
alias image path_to_image
|
8
|
+
alias shape_properties properties
|
9
|
+
|
10
|
+
def self.parse(picture_node)
|
11
|
+
picture = DocxPicture.new
|
12
|
+
picture_node.xpath('*').each do |picture_node_child|
|
13
|
+
case picture_node_child.name
|
14
|
+
when 'nvPicPr'
|
15
|
+
when 'blipFill'
|
16
|
+
picture.path_to_image = DocxBlip.parse(picture_node_child)
|
17
|
+
when 'spPr'
|
18
|
+
picture.properties = DocxShapeProperties.parse(picture_node_child)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
picture
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Picture = DocxPicture
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative 'shape_properties/docx_shape_properties'
|
2
|
+
require_relative 'shape_body_properties/ooxml_shape_body_properties'
|
3
|
+
# Docx Shape Data
|
4
|
+
module OoxmlParser
|
5
|
+
class DocxShape < OOXMLDocumentObject
|
6
|
+
attr_accessor :non_visual_properties, :properties, :style, :body_properties, :text_body
|
7
|
+
|
8
|
+
def self.parse(shape_node)
|
9
|
+
shape = DocxShape.new
|
10
|
+
shape_node.xpath('*').each do |shape_node_child|
|
11
|
+
case shape_node_child.name
|
12
|
+
when 'spPr'
|
13
|
+
shape.properties = DocxShapeProperties.parse(shape_node_child)
|
14
|
+
when 'txbx'
|
15
|
+
shape.text_body = OOXMLTextBox.parse(shape_node_child)
|
16
|
+
when 'txBody'
|
17
|
+
shape.text_body = TextBody.parse(shape_node_child)
|
18
|
+
when 'bodyPr'
|
19
|
+
shape.body_properties = OOXMLShapeBodyProperties.parse(shape_node_child)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
shape
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class PresetTextWarp < OOXMLDocumentObject
|
3
|
+
attr_accessor :preset
|
4
|
+
|
5
|
+
def self.parse(node)
|
6
|
+
preset_text_warp = PresetTextWarp.new
|
7
|
+
node.attributes.each do |key, value|
|
8
|
+
case key
|
9
|
+
when 'prst'
|
10
|
+
preset_text_warp.preset = value.value.to_sym
|
11
|
+
end
|
12
|
+
end
|
13
|
+
preset_text_warp
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Docx Shape Body Properties
|
2
|
+
require_relative 'ooxml_shape_body_properties/preset_text_warp'
|
3
|
+
|
4
|
+
module OoxmlParser
|
5
|
+
class OOXMLShapeBodyProperties < OOXMLDocumentObject
|
6
|
+
attr_accessor :margins, :anchor, :wrap, :preset_text_warp
|
7
|
+
|
8
|
+
alias vertical_align anchor
|
9
|
+
|
10
|
+
def self.parse(body_pr_node)
|
11
|
+
body_properties = OOXMLShapeBodyProperties.new
|
12
|
+
body_properties.margins = ParagraphMargins.parse(body_pr_node)
|
13
|
+
body_pr_node.attributes.each do |key, value|
|
14
|
+
case key
|
15
|
+
when 'wrap'
|
16
|
+
body_properties.wrap = value.value.to_sym
|
17
|
+
when 'anchor'
|
18
|
+
body_properties.anchor = Alignment.parse(value)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
body_pr_node.xpath('*').each do |body_properties_child|
|
22
|
+
case body_properties_child.name
|
23
|
+
when 'prstTxWarp'
|
24
|
+
body_properties.preset_text_warp = PresetTextWarp.parse(body_properties_child)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
body_properties
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# DOCX Color Scheme
|
2
|
+
module OoxmlParser
|
3
|
+
class DocxColorScheme < OOXMLDocumentObject
|
4
|
+
attr_accessor :color, :type
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@color = Color.new
|
8
|
+
@type = :unknown
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.parse(color_scheme_node)
|
12
|
+
color_scheme = DocxColorScheme.new
|
13
|
+
color_scheme_node.xpath('*').each do |color_scheme_node_child|
|
14
|
+
case color_scheme_node_child.name
|
15
|
+
when 'solidFill'
|
16
|
+
color_scheme.type = :solid
|
17
|
+
color_scheme.color = Color.parse_color_model(color_scheme_node_child)
|
18
|
+
when 'gradFill'
|
19
|
+
color_scheme.type = :gradient
|
20
|
+
color_scheme.color = GradientColor.parse(color_scheme_node_child)
|
21
|
+
when 'noFill'
|
22
|
+
color_scheme.color = :none
|
23
|
+
color_scheme.type = :none
|
24
|
+
when 'srgbClr'
|
25
|
+
color_scheme.color = Color.from_int16(color_scheme_node_child.attribute('val').value)
|
26
|
+
when 'schemeClr'
|
27
|
+
color_scheme.color = Color.parse_scheme_color(color_scheme_node_child)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
color_scheme
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_s
|
34
|
+
"Color: #{@color}, type: #{type}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Docx Pattern Fill Data
|
2
|
+
module OoxmlParser
|
3
|
+
class DocxPatternFill < OOXMLDocumentObject
|
4
|
+
attr_accessor :foreground_color, :background_color, :preset
|
5
|
+
|
6
|
+
def self.parse(fill_node)
|
7
|
+
pattern = DocxPatternFill.new
|
8
|
+
pattern.preset = fill_node.attribute('prst').value.to_sym
|
9
|
+
fill_node.xpath('*').each do |fill_node_child|
|
10
|
+
case fill_node_child.name
|
11
|
+
when 'fgClr'
|
12
|
+
pattern.foreground_color = Color.parse_color_model(fill_node_child)
|
13
|
+
when 'bgClr'
|
14
|
+
pattern.background_color = Color.parse_color_model(fill_node_child)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
pattern
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative 'docx_single_gradient_color'
|
2
|
+
# docx Gradient Color
|
3
|
+
module OoxmlParser
|
4
|
+
class DocxGradientColor < OOXMLDocumentObject
|
5
|
+
attr_accessor :gradient_stops, :type, :path
|
6
|
+
|
7
|
+
def initialize(colors = [])
|
8
|
+
@gradient_stops = colors
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.parse(gradient_fill_node)
|
12
|
+
gradient_color = DocxGradientColor.new
|
13
|
+
gradient_fill_node.xpath('*').each do |grad_fill_color_child|
|
14
|
+
case grad_fill_color_child.name
|
15
|
+
when 'gsLst'
|
16
|
+
grad_fill_color_child.xpath('a:gs', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').each do |gradient_single_color_node|
|
17
|
+
# gradient_single_color_node.xpath('*').each do |gradient_color_node|
|
18
|
+
single_gradient_color = DocxSingleGradientColor.new
|
19
|
+
single_gradient_color.color = Color.parse_color_model(gradient_single_color_node)
|
20
|
+
single_gradient_color.position = gradient_single_color_node.attribute('pos').value.to_f / 1_000.0
|
21
|
+
gradient_color.gradient_stops << single_gradient_color
|
22
|
+
end
|
23
|
+
when 'path'
|
24
|
+
gradient_color.path = grad_fill_color_child.attribute('path').value.to_sym
|
25
|
+
end
|
26
|
+
end
|
27
|
+
gradient_color
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Docx Shape Line Path
|
2
|
+
module OoxmlParser
|
3
|
+
class DocxShapeLinePath < OOXMLDocumentObject
|
4
|
+
attr_accessor :width, :height, :fill, :stroke, :elements
|
5
|
+
|
6
|
+
def initialize(elements = [])
|
7
|
+
@elements = elements
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.parse(path_node)
|
11
|
+
shape_line_path = DocxShapeLinePath.new
|
12
|
+
path_node.attributes.each do |key, value|
|
13
|
+
case key
|
14
|
+
when 'w'
|
15
|
+
shape_line_path.width = value.value.to_f
|
16
|
+
when 'h'
|
17
|
+
shape_line_path.height = value.value.to_f
|
18
|
+
when 'stroke'
|
19
|
+
shape_line_path.stroke = value.value.to_f
|
20
|
+
end
|
21
|
+
end
|
22
|
+
path_node.xpath('*').each do |line_path_element_node|
|
23
|
+
line_element = DocxShapeLineElement.new
|
24
|
+
case line_path_element_node.name
|
25
|
+
when 'moveTo'
|
26
|
+
line_element.type = :move
|
27
|
+
when 'lnTo'
|
28
|
+
line_element.type = :line
|
29
|
+
when 'arcTo'
|
30
|
+
line_element.type = :arc
|
31
|
+
when 'cubicBezTo'
|
32
|
+
line_element.type = :cubic_bezier
|
33
|
+
when 'quadBezTo'
|
34
|
+
line_element.type = :quadratic_bezier
|
35
|
+
when 'close'
|
36
|
+
line_element.type = :close
|
37
|
+
end
|
38
|
+
line_path_element_node.xpath('a:pt', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').each { |point_node| line_element.points << OOXMLCoordinates.parse(point_node, delimiter: 1) }
|
39
|
+
shape_line_path.elements << line_element
|
40
|
+
end
|
41
|
+
shape_line_path
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'docx_custom_geometry/docx_shape_line_element'
|
2
|
+
require_relative 'docx_custom_geometry/docx_shape_line_path'
|
3
|
+
# Docx Custom Geometry
|
4
|
+
module OoxmlParser
|
5
|
+
class OOXMLCustomGeometry
|
6
|
+
attr_accessor :paths_list
|
7
|
+
|
8
|
+
def initialize(paths_list = [])
|
9
|
+
@paths_list = paths_list
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.parse(custom_geometry_node)
|
13
|
+
custom_geometry = OOXMLCustomGeometry.new
|
14
|
+
custom_geometry_node.xpath('*').each do |custom_geometry_node_child|
|
15
|
+
case custom_geometry_node_child.name
|
16
|
+
when 'pathLst'
|
17
|
+
custom_geometry_node_child.xpath('a:path', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').each { |path_node| custom_geometry.paths_list << DocxShapeLinePath.parse(path_node) }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
custom_geometry
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative 'color/gradient_color/docx_gradient_color'
|
2
|
+
require_relative 'color/docx_pattern_fill'
|
3
|
+
# Color inside DOCX
|
4
|
+
module OoxmlParser
|
5
|
+
class DocxColor < OOXMLDocumentObject
|
6
|
+
attr_accessor :type, :value, :stretching_type, :alpha
|
7
|
+
|
8
|
+
def initialize(value = nil)
|
9
|
+
@value = value
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.parse(shape_properties_node)
|
13
|
+
fill_color = DocxColor.new
|
14
|
+
shape_properties_node.xpath('*').each do |fill_node|
|
15
|
+
case fill_node.name
|
16
|
+
when 'blipFill'
|
17
|
+
fill_color.type = :picture
|
18
|
+
fill_color.value = DocxBlip.parse(fill_node)
|
19
|
+
fill_node.xpath('*').each do |fill_type_node_child|
|
20
|
+
case fill_type_node_child.name
|
21
|
+
when 'tile'
|
22
|
+
fill_color.stretching_type = :tile
|
23
|
+
when 'stretch'
|
24
|
+
fill_color.stretching_type = :stretch
|
25
|
+
when 'blip'
|
26
|
+
fill_type_node_child.xpath('alphaModFix').each { |alpha_node| fill_color.alpha = alpha_node.attribute('amt').value.to_i / 1_000.0 }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
when 'solidFill'
|
30
|
+
fill_color.type = :solid
|
31
|
+
fill_color.value = Color.parse_color_model(fill_node)
|
32
|
+
when 'gradFill'
|
33
|
+
fill_color.type = :gradient
|
34
|
+
fill_color.value = DocxGradientColor.parse(fill_node)
|
35
|
+
when 'pattFill'
|
36
|
+
fill_color.type = :pattern
|
37
|
+
fill_color.value = DocxPatternFill.parse(fill_node)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
fill_color
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative 'color/docx_color_scheme'
|
2
|
+
require_relative 'line/line_end'
|
3
|
+
# Docx Shape Line
|
4
|
+
module OoxmlParser
|
5
|
+
class DocxShapeLine
|
6
|
+
attr_accessor :width, :color_scheme, :cap, :head_end, :tail_end, :fill
|
7
|
+
|
8
|
+
alias color color_scheme
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@width = 0
|
12
|
+
end
|
13
|
+
|
14
|
+
def stroke_size
|
15
|
+
if @color_scheme.nil? || @color_scheme.color == :none
|
16
|
+
0
|
17
|
+
else
|
18
|
+
@width
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def nil?
|
23
|
+
stroke_size == 0 && cap.nil?
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.parse(shape_line_node)
|
27
|
+
shape_line = DocxShapeLine.new
|
28
|
+
shape_line.width = (shape_line_node.attribute('w').value.to_f / 12_699.3).round(2) unless shape_line_node.attribute('w').nil?
|
29
|
+
unless shape_line_node.attribute('cap').nil?
|
30
|
+
case shape_line_node.attribute('cap').value
|
31
|
+
when 'rnd'
|
32
|
+
shape_line.cap = :round
|
33
|
+
when 'sq'
|
34
|
+
shape_line.cap = :square
|
35
|
+
when 'flat'
|
36
|
+
shape_line.cap = :flat
|
37
|
+
end
|
38
|
+
end
|
39
|
+
shape_line_node.xpath('*').each do |shape_line_node_child|
|
40
|
+
case shape_line_node_child.name
|
41
|
+
when 'solidFill'
|
42
|
+
shape_line.color_scheme = DocxColorScheme.parse(shape_line_node_child)
|
43
|
+
when 'noFill'
|
44
|
+
shape_line.width = 0
|
45
|
+
when 'headEnd'
|
46
|
+
shape_line.head_end = LineEnd.parse(shape_line_node_child)
|
47
|
+
when 'tailEnd'
|
48
|
+
shape_line.tail_end = LineEnd.parse(shape_line_node_child)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
shape_line
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Class for working with TextBox (w:txbxContent)
|
2
|
+
module OoxmlParser
|
3
|
+
class TextBox
|
4
|
+
# Parse TextBox List
|
5
|
+
# @param [Nokogiri::XML:Node] node with TextBox
|
6
|
+
# @return [Array] array of elements
|
7
|
+
def self.parse_list(node)
|
8
|
+
elements = []
|
9
|
+
text_box_content_node = node.xpath('w:txbxContent').first
|
10
|
+
unless text_box_content_node.nil?
|
11
|
+
text_box_content_node.xpath('*').each_with_index do |textbox_element, i|
|
12
|
+
case textbox_element.name
|
13
|
+
when 'p'
|
14
|
+
DocumentStructure.default_paragraph_style = DocxParagraph.new
|
15
|
+
DocumentStructure.default_paragraph_style.spacing = Spacing.new(0, 0.35, 1.15, :multiple)
|
16
|
+
elements << DocxParagraph.parse(textbox_element, i, DocumentStructure.default_paragraph_style)
|
17
|
+
when 'tbl'
|
18
|
+
elements << Table.parse(textbox_element, i)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
elements
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require_relative 'docx_color'
|
2
|
+
require_relative 'docx_shape_size'
|
3
|
+
require_relative 'docx_shape_line'
|
4
|
+
require_relative 'docx_shape_properties/text_box'
|
5
|
+
require_relative 'custom_geometry/ooxml_custom_geometry'
|
6
|
+
# DOCX Shape Properties
|
7
|
+
module OoxmlParser
|
8
|
+
class DocxShapeProperties < OOXMLDocumentObject
|
9
|
+
attr_accessor :shape_size, :preset_geometry, :fill_color, :text_box, :line, :custom_geometry
|
10
|
+
|
11
|
+
alias transform shape_size
|
12
|
+
alias fill fill_color
|
13
|
+
alias preset preset_geometry
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@line = DocxShapeLine.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.parse(shape_properties_node)
|
20
|
+
shape_properties = DocxShapeProperties.new
|
21
|
+
shape_properties.fill_color = DocxColor.parse(shape_properties_node)
|
22
|
+
shape_properties_node.xpath('*').each do |shape_properties_node_child|
|
23
|
+
case shape_properties_node_child.name
|
24
|
+
when 'xfrm'
|
25
|
+
shape_properties.shape_size = DocxShapeSize.parse(shape_properties_node_child)
|
26
|
+
when 'prstGeom'
|
27
|
+
shape_properties.preset_geometry = shape_properties_node_child.attribute('prst').value.to_sym
|
28
|
+
when 'txbx'
|
29
|
+
shape_properties.text_box = TextBox.parse_list(shape_properties_node_child)
|
30
|
+
when 'ln'
|
31
|
+
shape_properties.line = DocxShapeLine.parse(shape_properties_node_child)
|
32
|
+
when 'custGeom'
|
33
|
+
shape_properties.preset_geometry = :custom
|
34
|
+
shape_properties.custom_geometry = OOXMLCustomGeometry.parse(shape_properties_node_child)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
shape_properties
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Docx Shape Size
|
2
|
+
module OoxmlParser
|
3
|
+
class DocxShapeSize
|
4
|
+
attr_accessor :rotation, :flip_horizontal, :flip_vertical, :offset, :extent
|
5
|
+
|
6
|
+
alias extents extent
|
7
|
+
|
8
|
+
def self.parse(xfrm_node)
|
9
|
+
shape_size = DocxShapeSize.new
|
10
|
+
xfrm_node.attributes.each do |key, value|
|
11
|
+
case key
|
12
|
+
when 'rot'
|
13
|
+
shape_size.rotation = value.value.to_f
|
14
|
+
when 'flipH'
|
15
|
+
shape_size.flip_horizontal = value.value.to_f
|
16
|
+
when 'flipV'
|
17
|
+
shape_size.flip_vertical = value.value.to_f
|
18
|
+
end
|
19
|
+
end
|
20
|
+
xfrm_node.xpath('*').each do |xfrm_node_child|
|
21
|
+
case xfrm_node_child.name
|
22
|
+
when 'off'
|
23
|
+
shape_size.offset = OOXMLCoordinates.parse(xfrm_node_child)
|
24
|
+
when 'ext'
|
25
|
+
shape_size.extent = OOXMLCoordinates.parse(xfrm_node_child, x_attr: 'cx', y_attr: 'cy')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
shape_size
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Class for describing Line Size
|
2
|
+
module OoxmlParser
|
3
|
+
class LineSize
|
4
|
+
# Parse LineSize
|
5
|
+
# @param [Nokogiri::XML:Attr] node with LineSize
|
6
|
+
# @return [Symbol] value of LineSize
|
7
|
+
def self.parse(node)
|
8
|
+
case node
|
9
|
+
when 'lg'
|
10
|
+
:large
|
11
|
+
when 'med'
|
12
|
+
:medium
|
13
|
+
when 'sm'
|
14
|
+
:small
|
15
|
+
else
|
16
|
+
node.to_sym
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'line_end/line_size'
|
2
|
+
module OoxmlParser
|
3
|
+
class LineEnd < OOXMLDocumentObject
|
4
|
+
attr_accessor :type, :length, :width
|
5
|
+
|
6
|
+
def self.parse(line_end_node)
|
7
|
+
line_end = LineEnd.new
|
8
|
+
line_end_node.attributes.each do |key, value|
|
9
|
+
case key
|
10
|
+
when 'type'
|
11
|
+
line_end.type = value.value.to_sym
|
12
|
+
when 'w'
|
13
|
+
line_end.width = LineSize.parse(value.value)
|
14
|
+
when 'len'
|
15
|
+
line_end.length = LineSize.parse(value.value)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
line_end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|