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/paragraph/paragraph_run/run_properties/strikeout.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Class for describing strikeout
|
2
|
+
module OoxmlParser
|
3
|
+
class Strikeout
|
4
|
+
# Parse Strikeout
|
5
|
+
# @param [Nokogiri::XML:Attr] node with Strikeout
|
6
|
+
# @return [Symbol] value of Strikeout
|
7
|
+
def self.parse(node)
|
8
|
+
case node.value
|
9
|
+
when 'sngStrike'
|
10
|
+
:single
|
11
|
+
when 'dblStrike'
|
12
|
+
:double
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require_relative 'run_properties/outline'
|
2
|
+
require_relative 'run_properties/strikeout'
|
3
|
+
module OoxmlParser
|
4
|
+
class RunProperties < OOXMLDocumentObject
|
5
|
+
attr_accessor :font_style, :font_color, :space, :dirty, :font_name, :font_size, :baseline, :hyperlink, :caps,
|
6
|
+
:vertical_align, :outline
|
7
|
+
|
8
|
+
def initialize(font_name = '', font_style = FontStyle.new, font_color = nil, space = nil, baseline = :baseline)
|
9
|
+
@font_name = font_name
|
10
|
+
@font_style = font_style
|
11
|
+
@font_color = font_color
|
12
|
+
@space = space
|
13
|
+
@baseline = baseline
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.parse(character_props_node)
|
17
|
+
character_properties = RunProperties.new
|
18
|
+
character_properties.font_style = Presentation.current_font_style.dup
|
19
|
+
character_props_node.attributes.each do |key, value|
|
20
|
+
case key
|
21
|
+
when 'sz'
|
22
|
+
character_properties.font_size = value.value.to_f / 100.0
|
23
|
+
when 'spc'
|
24
|
+
character_properties.space = (value.value.to_f / 2_834.0).round(2)
|
25
|
+
when 'b'
|
26
|
+
character_properties.font_style.bold = OOXMLDocumentObject.option_enabled?(character_props_node, 'b')
|
27
|
+
when 'i'
|
28
|
+
character_properties.font_style.italic = OOXMLDocumentObject.option_enabled?(character_props_node, 'i')
|
29
|
+
when 'u'
|
30
|
+
character_properties.font_style.underlined = Underline.parse(value.value)
|
31
|
+
when 'strike'
|
32
|
+
character_properties.font_style.strike = Strikeout.parse(value)
|
33
|
+
when 'baseline'
|
34
|
+
case value.value.to_i
|
35
|
+
when -25_000, -30_000
|
36
|
+
character_properties.baseline = :subscript
|
37
|
+
when 30_000
|
38
|
+
character_properties.baseline = :superscript
|
39
|
+
when 0
|
40
|
+
character_properties.baseline = :baseline
|
41
|
+
end
|
42
|
+
when 'cap'
|
43
|
+
character_properties.caps = value.value.to_sym
|
44
|
+
end
|
45
|
+
end
|
46
|
+
character_properties.font_color = DocxColorScheme.parse(character_props_node)
|
47
|
+
character_props_node.xpath('*').each do |properties_element|
|
48
|
+
case properties_element.name
|
49
|
+
when 'solidFill'
|
50
|
+
character_properties.font_color = Color.parse_color(properties_element.xpath('*').first)
|
51
|
+
when 'latin'
|
52
|
+
character_properties.font_name = properties_element.attribute('typeface').value
|
53
|
+
when 'b'
|
54
|
+
character_properties.font_style.bold = OOXMLDocumentObject.option_enabled?(properties_element)
|
55
|
+
when 'i'
|
56
|
+
character_properties.font_style.italic = OOXMLDocumentObject.option_enabled?(properties_element, 'i')
|
57
|
+
when 'u'
|
58
|
+
character_properties.font_style.underlined = Underline.parse(properties_element.attribute('val').value)
|
59
|
+
when 'vertAlign'
|
60
|
+
character_properties.vertical_align = properties_element.attribute('val').value.to_sym
|
61
|
+
when 'rFont'
|
62
|
+
character_properties.font_name = properties_element.attribute('val').value
|
63
|
+
when 'color'
|
64
|
+
character_properties.font_color = Color.parse_color_tag(properties_element)
|
65
|
+
when 'strike'
|
66
|
+
character_properties.font_style.strike = OOXMLDocumentObject.option_enabled?(properties_element)
|
67
|
+
when 'hlinkClick'
|
68
|
+
character_properties.hyperlink = Hyperlink.parse(properties_element)
|
69
|
+
when 'ln'
|
70
|
+
character_properties.outline = Outline.parse(properties_element)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
character_properties.font_color = DocxColorScheme.parse(character_props_node)
|
74
|
+
character_properties.font_name = Presentation.default_font_typeface if character_properties.font_name.empty?
|
75
|
+
character_properties.font_size = Presentation.default_font_size if character_properties.font_size.nil?
|
76
|
+
character_properties
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'paragraph_run/run_properties'
|
2
|
+
module OoxmlParser
|
3
|
+
class ParagraphRun < OOXMLDocumentObject
|
4
|
+
attr_accessor :properties, :text
|
5
|
+
|
6
|
+
def initialize(properties = RunProperties.new, text = '')
|
7
|
+
@properties = properties
|
8
|
+
@text = text
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.parse(character_node)
|
12
|
+
character = ParagraphRun.new
|
13
|
+
character_node.xpath('*').each do |character_node_child|
|
14
|
+
case character_node_child.name
|
15
|
+
when 'rPr'
|
16
|
+
character.properties = RunProperties.parse(character_node_child)
|
17
|
+
when 't'
|
18
|
+
character.text = character_node_child.text
|
19
|
+
end
|
20
|
+
end
|
21
|
+
character
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class NumberingLevel
|
3
|
+
attr_accessor :ilvl, :start, :num_format, :level_text, :level_jc, :ind, :font
|
4
|
+
|
5
|
+
def initialize(ilvl = nil, start = nil, num_fmt = nil, lvl_text = nil, lvl_jc = nil, ind = nil, font = nil)
|
6
|
+
@ilvl = ilvl
|
7
|
+
@start = start
|
8
|
+
@num_format = num_fmt
|
9
|
+
@level_text = lvl_text
|
10
|
+
@level_jc = lvl_jc
|
11
|
+
@ind = ind
|
12
|
+
@font = font
|
13
|
+
end
|
14
|
+
|
15
|
+
def ==(other)
|
16
|
+
if @font.nil? || other.font.nil? # Ilya Kirillov change logic of numbering font of bullets, so check should be correct
|
17
|
+
@start.to_s == other.start.to_s && @num_format == other.num_format && @level_text == other.level_text &&
|
18
|
+
@ind.equal_with_round(other.ind)
|
19
|
+
else
|
20
|
+
@start.to_s == other.start.to_s && @num_format == other.num_format && @level_text == other.level_text &&
|
21
|
+
@ind.equal_with_round(other.ind) && @font == other.font
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require_relative 'numbering_properties/numbering_level'
|
2
|
+
module OoxmlParser
|
3
|
+
class NumberingProperties < OOXMLDocumentObject
|
4
|
+
attr_accessor :id, :nsid, :multilevel_type, :tmpl, :ilvls
|
5
|
+
|
6
|
+
def initialize(id = nil, multilevel_type = nil, ilvls = [])
|
7
|
+
@id = id
|
8
|
+
@multilevel_type = multilevel_type
|
9
|
+
@ilvls = ilvls
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.parse(id)
|
13
|
+
doc = Nokogiri::XML(File.open(OOXMLDocumentObject.path_to_folder + 'word/numbering.xml'), 'r:UTF-8')
|
14
|
+
numbering = NumberingProperties.new
|
15
|
+
numbering.id = id
|
16
|
+
doc.search('//w:num').each do |num|
|
17
|
+
next unless id == num.attribute('numId').value
|
18
|
+
num.xpath('w:abstractNumId').each do |abstract_num_id|
|
19
|
+
abstract_num_id = abstract_num_id.attribute('val').value
|
20
|
+
doc.search('//w:abstractNum').each do |abstract_num|
|
21
|
+
next unless abstract_num_id == abstract_num.attribute('abstractNumId').value
|
22
|
+
abstract_num.xpath('w:multiLevelType').each do |multilevel_type|
|
23
|
+
numbering.multilevel_type = multilevel_type.attribute('val').value
|
24
|
+
end
|
25
|
+
lvls = []
|
26
|
+
abstract_num.xpath('w:lvl').each do |lvl|
|
27
|
+
numbering_lvl = NumberingLevel.new
|
28
|
+
numbering_lvl.ilvl = lvl.attribute('ilvl').value
|
29
|
+
lvl.xpath('w:start').each do |start|
|
30
|
+
numbering_lvl.start = start.attribute('val').value
|
31
|
+
end
|
32
|
+
lvl.xpath('w:numFmt').each do |num_format|
|
33
|
+
numbering_lvl.num_format = num_format.attribute('val').value
|
34
|
+
end
|
35
|
+
lvl.xpath('w:lvlText').each do |level_text|
|
36
|
+
numbering_lvl.level_text = level_text.attribute('val').value
|
37
|
+
end
|
38
|
+
lvl.xpath('w:lvlJc').each do |level_jc|
|
39
|
+
numbering_lvl.level_jc = level_jc.attribute('val').value
|
40
|
+
end
|
41
|
+
lvl.xpath('w:pPr').each do |p_pr|
|
42
|
+
p_pr.xpath('w:ind').each do |ind|
|
43
|
+
numbering_lvl.ind = Indents.parse(ind)
|
44
|
+
end
|
45
|
+
lvl.xpath('w:rPr').each do |r_pr|
|
46
|
+
r_pr.xpath('w:rFonts').each do |r_fonts|
|
47
|
+
if !r_fonts.attribute('ascii').nil?
|
48
|
+
numbering_lvl.font = r_fonts.attribute('ascii').value
|
49
|
+
elsif !r_fonts.attribute('hAnsi').nil?
|
50
|
+
numbering_lvl.font = r_fonts.attribute('hAnsi').value
|
51
|
+
elsif !r_fonts.attribute('eastAsia').nil?
|
52
|
+
numbering_lvl.font = r_fonts.attribute('eastAsia').value
|
53
|
+
else
|
54
|
+
numbering_lvl.font = r_fonts.attribute('cs').value unless r_fonts.attribute('cs').nil?
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
lvls << numbering_lvl
|
60
|
+
end
|
61
|
+
numbering.ilvls = lvls
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
numbering
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative 'numbering/numbering_properties'
|
2
|
+
module OoxmlParser
|
3
|
+
class Numbering
|
4
|
+
attr_accessor :size, :font, :symbol, :start_at, :type, :ilvl, :numbering_properties
|
5
|
+
|
6
|
+
def initialize(ilvl = 0, numbering_properties = nil)
|
7
|
+
@ilvl = ilvl
|
8
|
+
@numbering_properties = numbering_properties
|
9
|
+
end
|
10
|
+
|
11
|
+
def numbering_level_current
|
12
|
+
@numbering_properties.ilvls.each do |current_ilvl|
|
13
|
+
return current_ilvl if current_ilvl.ilvl == @ilvl
|
14
|
+
end
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# endcoding: utf-8
|
2
|
+
# @author Pavel.Lobashov
|
3
|
+
|
4
|
+
# Class to describe spacing
|
5
|
+
module OoxmlParser
|
6
|
+
class Spacing
|
7
|
+
# @return [Float] Spacing before paragraph
|
8
|
+
attr_accessor :before
|
9
|
+
# @return [Float] Spacing after paragraph
|
10
|
+
attr_accessor :after
|
11
|
+
# @return [Float] Spacing between lines
|
12
|
+
attr_accessor :line
|
13
|
+
# @return [String] Spacing line rule
|
14
|
+
attr_accessor :line_rule
|
15
|
+
|
16
|
+
def initialize(before = nil, after = 0.35, line = nil, line_rule = nil)
|
17
|
+
@before = before
|
18
|
+
@after = after
|
19
|
+
@line = line
|
20
|
+
@line_rule = line_rule
|
21
|
+
end
|
22
|
+
|
23
|
+
def ==(other)
|
24
|
+
self.line_rule = :at_least if line_rule == 'atLeast'
|
25
|
+
self.line_rule = :multiple if line_rule == :auto
|
26
|
+
other.line_rule = :multiple if other.line_rule == :auto
|
27
|
+
if self.class == NilClass || other.class == NilClass
|
28
|
+
return true if self.class == NilClass && other.class == NilClass
|
29
|
+
return false
|
30
|
+
else
|
31
|
+
self.line_rule = line_rule.to_sym if line_rule.instance_of?(String)
|
32
|
+
|
33
|
+
if @before.to_f.round(2) == other.before.to_f.round(2) && @after.to_f.round(2) == other.after.to_f.round(2) &&
|
34
|
+
@line.to_f.round(2) == other.line.to_f.round(2) && @line_rule.to_s == other.line_rule.to_s
|
35
|
+
return true
|
36
|
+
else
|
37
|
+
return false
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_s
|
43
|
+
result_string = ''
|
44
|
+
variables = instance_variables
|
45
|
+
variables.each do |current_variable|
|
46
|
+
result_string += current_variable.to_s.sub('@', '') + ': ' + instance_variable_get(current_variable).to_s + "\n"
|
47
|
+
end
|
48
|
+
result_string
|
49
|
+
end
|
50
|
+
|
51
|
+
def copy
|
52
|
+
Spacing.new(@before, @after, @line, @line_rule)
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.default_spacing_canvas(line_spacing = 1.15)
|
56
|
+
Spacing.new(0.0, 0.35277777777777775, line_spacing)
|
57
|
+
end
|
58
|
+
|
59
|
+
def round(count_of_digits = 1)
|
60
|
+
before = @before.to_f.round(count_of_digits)
|
61
|
+
after = @after.to_f.round(count_of_digits)
|
62
|
+
line = @line.to_f.round(count_of_digits)
|
63
|
+
Spacing.new(before, after, line, @line_rule)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Parse data for Spacing
|
67
|
+
# @param [Nokogiri::XML:Element] node with Spacing
|
68
|
+
# @return [Nothing]
|
69
|
+
def parse(node)
|
70
|
+
node.xpath('*').each do |spacing_node_child|
|
71
|
+
case spacing_node_child.name
|
72
|
+
when 'lnSpc'
|
73
|
+
self.line = Spacing.parse_spacing_value(spacing_node_child)
|
74
|
+
self.line_rule = Spacing.parse_spacing_rule(spacing_node_child)
|
75
|
+
when 'spcBef'
|
76
|
+
self.before = Spacing.parse_spacing_value(spacing_node_child)
|
77
|
+
when 'spcAft'
|
78
|
+
self.after = Spacing.parse_spacing_value(spacing_node_child)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Parse values of spacing number
|
84
|
+
# @param [Nokogiri::XML:Element] node with Spacing
|
85
|
+
# @return [Float] value of spacing number
|
86
|
+
def self.parse_spacing_value(node)
|
87
|
+
node.xpath('*').each do |spacing_node_child|
|
88
|
+
case spacing_node_child.name
|
89
|
+
when 'spcPct'
|
90
|
+
return (spacing_node_child.attribute('val').value.to_f / 100_000.0).round(2)
|
91
|
+
when 'spcPts'
|
92
|
+
return (spacing_node_child.attribute('val').value.to_f / 2_834.0).round(2)
|
93
|
+
else
|
94
|
+
return (spacing_node_child.attribute('val').value.to_f / 1_000.0).round(2)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# Parse spacing rule
|
100
|
+
# @param [Nokogiri::XML:Element] node with Spacing
|
101
|
+
# @return [Symbol] type of spacing rule
|
102
|
+
def self.parse_spacing_rule(node)
|
103
|
+
node.xpath('*').each do |spacing_node_child|
|
104
|
+
case spacing_node_child.name
|
105
|
+
when 'spcPct'
|
106
|
+
return :multiple
|
107
|
+
when 'spcPts'
|
108
|
+
return :exact
|
109
|
+
else
|
110
|
+
return :at_least
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative 'paragraph/paragraph_properties'
|
2
|
+
require_relative 'paragraph/paragraph_run'
|
3
|
+
module OoxmlParser
|
4
|
+
class Paragraph
|
5
|
+
attr_accessor :properties, :runs, :text_field, :formulas
|
6
|
+
|
7
|
+
def initialize(runs = [], formulas = [])
|
8
|
+
@runs = runs
|
9
|
+
@formulas = formulas
|
10
|
+
@runs = []
|
11
|
+
end
|
12
|
+
|
13
|
+
alias characters runs
|
14
|
+
alias character_style_array runs
|
15
|
+
alias characters= runs=
|
16
|
+
alias character_style_array= runs=
|
17
|
+
|
18
|
+
def self.parse(paragraph_node)
|
19
|
+
paragraph = Paragraph.new
|
20
|
+
paragraph_node.xpath('*').each do |paragraph_node_child|
|
21
|
+
case paragraph_node_child.name
|
22
|
+
when 'pPr'
|
23
|
+
paragraph.properties = ParagraphProperties.parse(paragraph_node_child)
|
24
|
+
when 'fld'
|
25
|
+
paragraph.text_field = TextField.parse(paragraph_node_child)
|
26
|
+
when 'r'
|
27
|
+
paragraph.characters << ParagraphRun.parse(paragraph_node_child)
|
28
|
+
when 'm'
|
29
|
+
# TODO: add parsing formulas in paragraph
|
30
|
+
end
|
31
|
+
end
|
32
|
+
paragraph
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class ParagraphMargins < TableMargins
|
3
|
+
def initialize(top = 0.0, bottom = 0.0, left = 0.0, right = 0.0)
|
4
|
+
@top = top
|
5
|
+
@bottom = bottom
|
6
|
+
@left = left
|
7
|
+
@right = right
|
8
|
+
end
|
9
|
+
|
10
|
+
def round(count_of_digits = 1)
|
11
|
+
top = @top.round(count_of_digits)
|
12
|
+
bottom = @bottom.round(count_of_digits)
|
13
|
+
left = @left.round(count_of_digits)
|
14
|
+
right = @right.round(count_of_digits)
|
15
|
+
ParagraphMargins.new(top, bottom, left, right)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.parse(text_body_props_node)
|
19
|
+
margins = ParagraphMargins.new(0.127, 0.127, 0.254, 0.254)
|
20
|
+
text_body_props_node.attributes.each do |key, value|
|
21
|
+
case key
|
22
|
+
when 'bIns', 'marB'
|
23
|
+
margins.bottom = (value.value.to_f / 360_000.0).round(3)
|
24
|
+
when 'tIns', 'marT'
|
25
|
+
margins.top = (value.value.to_f / 360_000.0).round(3)
|
26
|
+
when 'lIns', 'marL'
|
27
|
+
margins.left = (value.value.to_f / 360_000.0).round(3)
|
28
|
+
when 'rIns', 'marR'
|
29
|
+
margins.right = (value.value.to_f / 360_000.0).round(3)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
margins
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module OoxmlParser
|
2
|
+
class TableMargins
|
3
|
+
attr_accessor :is_default, :top, :bottom, :left, :right
|
4
|
+
|
5
|
+
def initialize(is_default = true, top = nil, bottom = nil, left = nil, right = nil)
|
6
|
+
@is_default = is_default
|
7
|
+
@top = top
|
8
|
+
@bottom = bottom
|
9
|
+
@left = left
|
10
|
+
@right = right
|
11
|
+
end
|
12
|
+
|
13
|
+
def ==(other)
|
14
|
+
(@top - other.top).round(2) == 0 && (@bottom - other.bottom).round(2) == 0 &&
|
15
|
+
(@left - other.left).round(2) == 0 && (@right - other.right).round(2) == 0
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
'Default: ' + is_default.to_s + ' top: ' + @top.to_s + ', bottom: ' + @bottom.to_s + ', left: ' + @left.to_s + ', right: ' + @right.to_s
|
20
|
+
end
|
21
|
+
|
22
|
+
def round(count_of_digits = 1)
|
23
|
+
top = @top.round(count_of_digits)
|
24
|
+
bottom = @bottom.round(count_of_digits)
|
25
|
+
left = @left.round(count_of_digits)
|
26
|
+
right = @right.round(count_of_digits)
|
27
|
+
TableMargins.new(@is_default, top, bottom, left, right)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.parse(margin_node)
|
31
|
+
cell_margins = TableMargins.new
|
32
|
+
margin_node.xpath('*').each do |cell_margin_node|
|
33
|
+
case cell_margin_node.name
|
34
|
+
when 'left'
|
35
|
+
cell_margins.left = (cell_margin_node.attribute('w').value.to_f / 566.9).round(2)
|
36
|
+
when 'top'
|
37
|
+
cell_margins.top = (cell_margin_node.attribute('w').value.to_f / 566.9).round(2)
|
38
|
+
when 'right'
|
39
|
+
cell_margins.right = (cell_margin_node.attribute('w').value.to_f / 566.9).round(2)
|
40
|
+
when 'bottom'
|
41
|
+
cell_margins.bottom = (cell_margin_node.attribute('w').value.to_f / 566.9).round(2)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
cell_margins
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Table Cell Margin data
|
2
|
+
module OoxmlParser
|
3
|
+
class TableCellMargin
|
4
|
+
attr_accessor :left, :right, :top, :bottom
|
5
|
+
|
6
|
+
def initialize(left = nil, right = nil, top = nil, bottom = nil)
|
7
|
+
@left = left
|
8
|
+
@top = top
|
9
|
+
@right = right
|
10
|
+
@bottom = bottom
|
11
|
+
end
|
12
|
+
|
13
|
+
def ==(other)
|
14
|
+
@left == other.left &&
|
15
|
+
@top == other.top &&
|
16
|
+
@right == other.right &&
|
17
|
+
@bottom == other.bottom
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative 'whole_table/table_cell_style'
|
2
|
+
# Describe single table element
|
3
|
+
module OoxmlParser
|
4
|
+
class TableElement
|
5
|
+
attr_accessor :cell_style
|
6
|
+
|
7
|
+
alias cell_properties cell_style
|
8
|
+
|
9
|
+
def self.parse(whole_table_node)
|
10
|
+
table_element = TableElement.new
|
11
|
+
whole_table_node.xpath('*').each do |whole_table_node_child|
|
12
|
+
case whole_table_node_child.name
|
13
|
+
when 'tcStyle', 'tcPr'
|
14
|
+
table_element.cell_style = CellProperties.parse(whole_table_node_child)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
table_element
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Describe look of table
|
2
|
+
module OoxmlParser
|
3
|
+
class TableLook < OOXMLDocumentObject
|
4
|
+
attr_accessor :first_row, :first_column, :last_row, :last_column, :banding_row, :banding_column, :no_horizontal_banding,
|
5
|
+
:no_vertical_banding
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@first_row = false
|
9
|
+
@first_column = false
|
10
|
+
@last_row = false
|
11
|
+
@last_column = false
|
12
|
+
@banding_row = false
|
13
|
+
@banding_column = false
|
14
|
+
@no_horizontal_banding = false
|
15
|
+
@no_horizontal_banding = false
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.parse(table_look_node)
|
19
|
+
table_look = TableLook.new
|
20
|
+
table_look_node.attributes.each do |key, value|
|
21
|
+
case key
|
22
|
+
when 'firstRow'
|
23
|
+
table_look.first_row = OOXMLDocumentObject.option_enabled?(value)
|
24
|
+
when 'lastRow'
|
25
|
+
table_look.last_row = OOXMLDocumentObject.option_enabled?(value)
|
26
|
+
when 'firstCol', 'firstColumn'
|
27
|
+
table_look.first_column = OOXMLDocumentObject.option_enabled?(value)
|
28
|
+
when 'lastCol', 'lastColumn'
|
29
|
+
table_look.last_column = OOXMLDocumentObject.option_enabled?(value)
|
30
|
+
when 'noHBand'
|
31
|
+
table_look.no_horizontal_banding = OOXMLDocumentObject.option_enabled?(value)
|
32
|
+
when 'noVBand'
|
33
|
+
table_look.no_vertical_banding = OOXMLDocumentObject.option_enabled?(value)
|
34
|
+
when 'bandRow'
|
35
|
+
table_look.banding_row = OOXMLDocumentObject.option_enabled?(value)
|
36
|
+
when 'bandCol'
|
37
|
+
table_look.banding_column = OOXMLDocumentObject.option_enabled?(value)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
table_look
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Table Position Data
|
2
|
+
module OoxmlParser
|
3
|
+
class TablePosition
|
4
|
+
attr_accessor :left, :right, :top, :bottom, :position_x, :position_y, :horizontal_anchor, :vertical_anchor, :vertical_align_from_anchor,
|
5
|
+
:horizontal_align_from_anchor
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@left = nil
|
9
|
+
@right = nil
|
10
|
+
@top = nil
|
11
|
+
@bottom = nil
|
12
|
+
@position_x = nil
|
13
|
+
@position_y = nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
'Table position left: ' + @left.to_s + ', right: ' + @right.to_s + ', top: ' + @top.to_s + ', bottom: ' + @bottom.to_s + 'position x: ' + position_x.to_s + 'position y: ' + position_x.to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.parse(node)
|
21
|
+
table_p_properties = TablePosition.new
|
22
|
+
node.attributes.each do |key, value|
|
23
|
+
case key
|
24
|
+
when 'leftFromText'
|
25
|
+
table_p_properties.left = value.value.to_f / 567.5
|
26
|
+
when 'rightFromText'
|
27
|
+
table_p_properties.right = value.value.to_f / 567.5
|
28
|
+
when 'topFromText'
|
29
|
+
table_p_properties.top = value.value.to_f / 567.5
|
30
|
+
when 'bottomFromText'
|
31
|
+
table_p_properties.bottom = value.value.to_f / 567.5
|
32
|
+
when 'tblpX'
|
33
|
+
table_p_properties.position_x = (value.value.to_f / 566.9).round(3)
|
34
|
+
when 'tblpY'
|
35
|
+
table_p_properties.position_y = (value.value.to_f / 566.9).round(3)
|
36
|
+
when 'vertAnchor'
|
37
|
+
table_p_properties.vertical_anchor = value.value.to_sym
|
38
|
+
when 'horzAnchor'
|
39
|
+
table_p_properties.horizontal_anchor = value.value.to_sym
|
40
|
+
when 'tblpXSpec'
|
41
|
+
table_p_properties.horizontal_align_from_anchor = value.value.to_sym
|
42
|
+
when 'tblpYSpec'
|
43
|
+
table_p_properties.vertical_align_from_anchor = value.value.to_sym
|
44
|
+
end
|
45
|
+
end
|
46
|
+
table_p_properties
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|