ooxml_parser 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +7 -0
  2. data/.overcommit.yml +35 -0
  3. data/Changelog.md +25 -0
  4. data/LICENSE.txt +661 -0
  5. data/README.md +26 -0
  6. data/circle.yml +3 -0
  7. data/lib/ooxml_parser/common_parser/common_data/alingment.rb +56 -0
  8. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +34 -0
  9. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +123 -0
  10. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +34 -0
  11. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +38 -0
  12. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +23 -0
  13. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +33 -0
  14. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_point.rb +11 -0
  15. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_style/office_2007_chart_style.rb +17 -0
  16. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_style/office_2010_chart_style.rb +17 -0
  17. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +26 -0
  18. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +49 -0
  19. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +23 -0
  20. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +35 -0
  21. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +11 -0
  22. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +39 -0
  23. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +32 -0
  24. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +34 -0
  25. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/group/docx_group_element.rb +10 -0
  26. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/group/docx_grouped_drawing.rb +34 -0
  27. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +27 -0
  28. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +26 -0
  29. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +25 -0
  30. 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
  31. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +30 -0
  32. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +37 -0
  33. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +20 -0
  34. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_gradient_color.rb +30 -0
  35. 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
  36. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/solid_color/docx_solid_color.rb +10 -0
  37. 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
  38. 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
  39. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +23 -0
  40. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +43 -0
  41. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +54 -0
  42. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +25 -0
  43. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +40 -0
  44. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +31 -0
  45. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end/line_size.rb +20 -0
  46. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +21 -0
  47. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_style/docx_shape_style.rb +5 -0
  48. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +31 -0
  49. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_element.rb +10 -0
  50. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_properties.rb +6 -0
  51. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +26 -0
  52. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +24 -0
  53. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +26 -0
  54. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +24 -0
  55. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/common_non_visual_properties.rb +25 -0
  56. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/non_visual_properties.rb +19 -0
  57. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/non_visual_shape_properties.rb +20 -0
  58. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape.rb +28 -0
  59. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_placeholder.rb +18 -0
  60. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/ooxml_shift.rb +15 -0
  61. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/transform_effect.rb +28 -0
  62. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties.rb +13 -0
  63. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/ooxml_text_box.rb +26 -0
  64. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/text_body.rb +23 -0
  65. data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +58 -0
  66. data/lib/ooxml_parser/common_parser/common_data/color.rb +473 -0
  67. data/lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb +14 -0
  68. data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +21 -0
  69. data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +150 -0
  70. data/lib/ooxml_parser/common_parser/common_data/colors/image/fill_rectangle.rb +22 -0
  71. data/lib/ooxml_parser/common_parser/common_data/colors/image/stretching.rb +11 -0
  72. data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +32 -0
  73. data/lib/ooxml_parser/common_parser/common_data/colors/image_properties.rb +16 -0
  74. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +15 -0
  75. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +10 -0
  76. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +35 -0
  77. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +22 -0
  78. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +33 -0
  79. data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +14 -0
  80. data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +22 -0
  81. data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +21 -0
  82. data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +127 -0
  83. data/lib/ooxml_parser/common_parser/common_data/font_style.rb +101 -0
  84. data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +53 -0
  85. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +87 -0
  86. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +48 -0
  87. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +23 -0
  88. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/strikeout.rb +16 -0
  89. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +79 -0
  90. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +24 -0
  91. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering/numbering_properties/numbering_level.rb +25 -0
  92. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering/numbering_properties.rb +69 -0
  93. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering.rb +18 -0
  94. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +115 -0
  95. data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +35 -0
  96. data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +35 -0
  97. data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +47 -0
  98. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_cell_margin.rb +20 -0
  99. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +20 -0
  100. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +43 -0
  101. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +49 -0
  102. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +83 -0
  103. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_elements.rb +21 -0
  104. data/lib/ooxml_parser/common_parser/common_data/table/properties/whole_table/line_join.rb +19 -0
  105. data/lib/ooxml_parser/common_parser/common_data/table/properties/whole_table/table_cell_style.rb +20 -0
  106. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +43 -0
  107. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +142 -0
  108. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb +18 -0
  109. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +25 -0
  110. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +125 -0
  111. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +35 -0
  112. data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +22 -0
  113. data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +33 -0
  114. data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +9 -0
  115. data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +77 -0
  116. data/lib/ooxml_parser/common_parser/common_data/table.rb +41 -0
  117. data/lib/ooxml_parser/common_parser/common_data/underline.rb +40 -0
  118. data/lib/ooxml_parser/common_parser/common_document_structure.rb +7 -0
  119. data/lib/ooxml_parser/configuration.rb +20 -0
  120. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb +28 -0
  121. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +10 -0
  122. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +21 -0
  123. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +70 -0
  124. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +11 -0
  125. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +10 -0
  126. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +11 -0
  127. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +12 -0
  128. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +11 -0
  129. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +11 -0
  130. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +13 -0
  131. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +12 -0
  132. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +12 -0
  133. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +10 -0
  134. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +10 -0
  135. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/operator.rb +13 -0
  136. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +11 -0
  137. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +203 -0
  138. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/offset.rb +10 -0
  139. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shadow.rb +10 -0
  140. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_margins.rb +11 -0
  141. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_size.rb +10 -0
  142. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/stroke.rb +10 -0
  143. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties.rb +16 -0
  144. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +40 -0
  145. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +13 -0
  146. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +22 -0
  147. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +388 -0
  148. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +46 -0
  149. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +87 -0
  150. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/bookmark.rb +10 -0
  151. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/paragraph_tab.rb +19 -0
  152. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb +35 -0
  153. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb +56 -0
  154. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +324 -0
  155. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +37 -0
  156. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/image.rb +15 -0
  157. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +10 -0
  158. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +37 -0
  159. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +29 -0
  160. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +49 -0
  161. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +42 -0
  162. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +88 -0
  163. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/size.rb +84 -0
  164. data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +232 -0
  165. data/lib/ooxml_parser/docx_parser/docx_parser.rb +16 -0
  166. data/lib/ooxml_parser/helpers/string_helper.rb +22 -0
  167. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb +25 -0
  168. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment.rb +31 -0
  169. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +40 -0
  170. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +44 -0
  171. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +19 -0
  172. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +34 -0
  173. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +25 -0
  174. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +23 -0
  175. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/shape_properties/extents.rb +10 -0
  176. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/shape_properties/offset.rb +10 -0
  177. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/text_body/paragraph.rb +10 -0
  178. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/text_body/text_field.rb +18 -0
  179. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shapes_grouping/shapes_grouping.rb +9 -0
  180. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping/grouping_properties.rb +16 -0
  181. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +30 -0
  182. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +22 -0
  183. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +28 -0
  184. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +31 -0
  185. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +20 -0
  186. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition.rb +26 -0
  187. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +33 -0
  188. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +52 -0
  189. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +23 -0
  190. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/sound_action/sound/sound.rb +18 -0
  191. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/sound_action/sound_action.rb +18 -0
  192. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +43 -0
  193. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +9 -0
  194. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +110 -0
  195. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +20 -0
  196. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +62 -0
  197. data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +15 -0
  198. data/lib/ooxml_parser/version.rb +6 -0
  199. 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
  200. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character.rb +25 -0
  201. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +20 -0
  202. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +43 -0
  203. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb +21 -0
  204. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +23 -0
  205. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +18 -0
  206. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +24 -0
  207. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position/xlsx_drawing_position_parameters.rb +22 -0
  208. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position.rb +22 -0
  209. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb +37 -0
  210. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +49 -0
  211. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb +30 -0
  212. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/foreground_color.rb +25 -0
  213. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/ooxml_font.rb +38 -0
  214. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style.rb +95 -0
  215. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +47 -0
  216. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +19 -0
  217. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_table.rb +30 -0
  218. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +74 -0
  219. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +108 -0
  220. data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +15 -0
  221. data/lib/ooxml_parser.rb +35 -0
  222. data/ooxml_parser.gemspec +30 -0
  223. metadata +310 -0
@@ -0,0 +1,203 @@
1
+ # Class for containg DocxFormulas
2
+ require_relative 'docx_formula/accent'
3
+ require_relative 'docx_formula/bar'
4
+ require_relative 'docx_formula/box'
5
+ require_relative 'docx_formula/delimeter'
6
+ require_relative 'docx_formula/fraction'
7
+ require_relative 'docx_formula/function'
8
+ require_relative 'docx_formula/group_char'
9
+ require_relative 'docx_formula/limit'
10
+ require_relative 'docx_formula/matrix'
11
+ require_relative 'docx_formula/operator'
12
+ require_relative 'docx_formula/index'
13
+ require_relative 'docx_formula/radical'
14
+ module OoxmlParser
15
+ class DocxFormula
16
+ attr_accessor :elements
17
+
18
+ def initialize(elements = [])
19
+ @elements = elements
20
+ end
21
+
22
+ def self.parse(element)
23
+ formula = DocxFormula.new
24
+ element.xpath('*').each do |sub_element|
25
+ if sub_element.name == 'r'
26
+ formula.elements << parse_math_character(sub_element)
27
+ elsif sub_element.name == 'box'
28
+ box = Box.new
29
+ box.element = parse_math_character(sub_element)
30
+ formula.elements << box
31
+ elsif sub_element.name == 'borderBox'
32
+ box = Box.new
33
+ box.borders = true
34
+ box.element = parse_math_character(sub_element)
35
+ formula.elements << box
36
+ elsif sub_element.name == 'func'
37
+ function = Function.new
38
+ sub_element.xpath('m:fName').each do |f_name|
39
+ function.name = DocxFormula.parse(f_name)
40
+ end
41
+ function.argument = DocxFormula.parse(sub_element)
42
+ formula.elements << function
43
+ elsif sub_element.name == 'rad'
44
+ radical = Radical.new
45
+ radical.value = DocxFormula.parse(sub_element)
46
+ sub_element.xpath('m:deg').each do |deg|
47
+ radical.degree = DocxFormula.parse(deg)
48
+ radical.degree = 2 if radical.degree.nil?
49
+ end
50
+ formula.elements << radical
51
+ elsif sub_element.name == 'e'
52
+ formula.elements << DocxFormula.parse(sub_element)
53
+ elsif sub_element.name == 'eqArr'
54
+ sub_element.xpath('m:e').each do |e|
55
+ formula.elements << DocxFormula.parse(e)
56
+ end
57
+ elsif sub_element.name == 'd'
58
+ delimeter = Delimiter.new
59
+ sub_element.xpath('m:dPr').each do |d_pr|
60
+ d_pr.xpath('m:begChr').each do |beg_chr|
61
+ delimeter.begin_character = beg_chr.attribute('val').value
62
+ end
63
+ d_pr.xpath('m:endChr').each do |end_chr|
64
+ delimeter.end_character = end_chr.attribute('val').value
65
+ end
66
+ end
67
+ delimeter.value = DocxFormula.parse(sub_element)
68
+ formula.elements << delimeter
69
+ elsif sub_element.name == 'nary'
70
+ operator = Operator.new
71
+ sub_element.xpath('m:naryPr').each do |nary_pr|
72
+ nary_pr.xpath('m:chr').each do |chr|
73
+ operator.operator = chr.attribute('val').value
74
+ end
75
+ end
76
+ sub_element.xpath('m:sub').each do |sub|
77
+ operator.bottom_value = DocxFormula.parse(sub)
78
+ end
79
+ sub_element.xpath('m:sup').each do |sup|
80
+ operator.top_value = DocxFormula.parse(sup)
81
+ end
82
+ operator.value = DocxFormula.parse(sub_element)
83
+ formula.elements << operator
84
+ elsif sub_element.name == 'sSubSup'
85
+ index = Index.new
86
+ index.value = DocxFormula.parse(sub_element)
87
+ sub_element.xpath('m:sup').each do |sup|
88
+ index.top_index = DocxFormula.parse(sup)
89
+ end
90
+ sub_element.xpath('m:sub').each do |sub|
91
+ index.top_index = DocxFormula.parse(sub)
92
+ end
93
+ formula.elements << index
94
+ elsif sub_element.name == 'sSup'
95
+ index = Index.new
96
+ index.value = DocxFormula.parse(sub_element)
97
+ sub_element.xpath('m:sup').each do |sup|
98
+ index.top_index = DocxFormula.parse(sup)
99
+ end
100
+ formula.elements << index
101
+ elsif sub_element.name == 'sSub'
102
+ index = Index.new
103
+ index.value = DocxFormula.parse(sub_element)
104
+ sub_element.xpath('m:sub').each do |sub|
105
+ index.top_index = DocxFormula.parse(sub)
106
+ end
107
+ formula.elements << index
108
+ elsif sub_element.name == 'f'
109
+ fraction = Fraction.new
110
+ sub_element.xpath('m:num').each do |num|
111
+ fraction.numerator = DocxFormula.parse(num)
112
+ end
113
+ sub_element.xpath('m:den').each do |den|
114
+ fraction.denominator = DocxFormula.parse(den)
115
+ formula.elements << fraction
116
+ end
117
+ elsif sub_element.name == 'm'
118
+ matrix = Matrix.new
119
+ columns_count = 1
120
+ j = 0
121
+ sub_element.xpath('m:mPr').each do |m_pr|
122
+ m_pr.xpath('m:mcs').each do |mcs|
123
+ mcs.xpath('m:mc').each do |mc|
124
+ mc.xpath('m:mcPr').each do |mc_pr|
125
+ mc_pr.xpath('m:count').each do |count|
126
+ columns_count = count.attribute('val').value
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end
132
+ sub_element.xpath('m:mr').each do |mr|
133
+ i = 0
134
+ matrix.rows << MatrixRow.new(columns_count.to_i)
135
+ mr.xpath('m:e').each do |e|
136
+ matrix.rows[j].columns[i] = DocxFormula.parse(e)
137
+ i += 1
138
+ end
139
+ j += 1
140
+ end
141
+ formula.elements << matrix
142
+ elsif sub_element.name == 'bar'
143
+ bar = Bar.new
144
+ sub_element.xpath('m:barPr').each do |bar_pr|
145
+ bar_pr.xpath('m:pos').each do |pos|
146
+ bar.position = pos.attribute('val').value
147
+ end
148
+ end
149
+ bar.element = DocxFormula.parse(sub_element)
150
+ formula.elements << bar
151
+ elsif sub_element.name == 'acc'
152
+ accent = Accent.new
153
+ sub_element.xpath('m:accPr').each do |acc_pr|
154
+ acc_pr.xpath('m:chr').each do |chr|
155
+ accent.symbol = chr.attribute('val').value
156
+ end
157
+ end
158
+ accent.element = DocxFormula.parse(sub_element)
159
+ formula.elements << accent
160
+ elsif sub_element.name == 'groupChr'
161
+ group_char = GroupChar.new
162
+ sub_element.xpath('m:groupChrPr').each do |group_chr_pr|
163
+ group_chr_pr.xpath('m:chr').each do |chr|
164
+ group_char.symbol = chr.attribute('val').value
165
+ end
166
+ group_chr_pr.xpath('m:pos').each do |pos|
167
+ group_char.position = pos.attribute('val').value
168
+ end
169
+ group_chr_pr.xpath('vertJc').each do |vert_jc|
170
+ group_char.vertical_align = vert_jc.attribute('val').value
171
+ end
172
+ end
173
+ group_char.element = DocxFormula.parse(sub_element)
174
+ formula.elements << group_char
175
+ elsif sub_element.name == 'limUpp'
176
+ limit = Limit.new
177
+ limit.type = 'Upper'
178
+ limit.element = DocxFormula.parse(sub_element)
179
+ sub_element.xpath('m:lim').each do |lim|
180
+ limit.limit = DocxFormula.parse(lim)
181
+ end
182
+ formula.elements << limit
183
+ elsif sub_element.name == 'limLow'
184
+ limit = Limit.new
185
+ limit.type = 'Lower'
186
+ limit.element = DocxFormula.parse(sub_element)
187
+ sub_element.xpath('m:lim').each do |lim|
188
+ limit.limit = DocxFormula.parse(lim)
189
+ end
190
+ formula.elements << limit
191
+ end
192
+ end
193
+ return nil if formula.elements.empty?
194
+ formula
195
+ end
196
+
197
+ def self.parse_math_character(element)
198
+ element.xpath('m:t').each do |t|
199
+ return t.text
200
+ end
201
+ end
202
+ end
203
+ end
@@ -0,0 +1,10 @@
1
+ module OoxmlParser
2
+ class Offset
3
+ attr_accessor :x, :y
4
+
5
+ def initialize(x = '', y = '')
6
+ @x = x
7
+ @y = y
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module OoxmlParser
2
+ class Shadow
3
+ attr_accessor :color, :offset
4
+
5
+ def initialize(color = nil, offset = nil)
6
+ @color = color
7
+ @offset = offset
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ module OoxmlParser
2
+ class ShapeMargins
3
+ attr_accessor :left, :right, :top
4
+
5
+ def initialize(left = nil, right = nil, top = nil)
6
+ @left = left
7
+ @right = right
8
+ @top = top
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module OoxmlParser
2
+ class ShapeSize
3
+ attr_accessor :width, :height
4
+
5
+ def initialize(width = nil, height = nil)
6
+ @width = width
7
+ @height = height
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module OoxmlParser
2
+ class Stroke
3
+ attr_accessor :weight, :color
4
+
5
+ def initialize(weight = nil, color = nil)
6
+ @weight = weight
7
+ @color = color
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'shape_properties/shape_margins'
2
+ require_relative 'shape_properties/shape_size'
3
+ require_relative 'shape_properties/stroke'
4
+ module OoxmlParser
5
+ class ShapeProperties
6
+ attr_accessor :fill_color, :anchor_x, :anchor_y, :shadow, :margins, :size, :opacity, :position, :z_index, :stroke
7
+
8
+ def initialize(position = nil, margins = ShapeMargins.new, size = ShapeSize.new, z_index = nil, stroke = Stroke.new)
9
+ @position = position
10
+ @margins = margins
11
+ @size = size
12
+ @z_index = z_index
13
+ @stroke = stroke
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,40 @@
1
+ require_relative 'shape/shape_properties'
2
+ module OoxmlParser
3
+ class Shape < OOXMLDocumentObject
4
+ attr_accessor :type, :properties, :elements
5
+
6
+ def initialize(type = nil, properties = ShapeProperties.new, elements = [])
7
+ @type = type
8
+ @properties = properties
9
+ @elements = elements
10
+ end
11
+
12
+ def self.parse(shape_node, type, path)
13
+ shape = Shape.new
14
+ shape.type = type
15
+ shape_node.attribute('style').value.to_s.split(';').each do |property|
16
+ case
17
+ when property.include?('margin-top')
18
+ shape.properties.margins.top = property.split(':').last
19
+ when property.include?('margin-left')
20
+ shape.properties.margins.left = property.split(':').last
21
+ when property.include?('margin-right')
22
+ shape.properties.margins.right = property.split(':').last
23
+ when property.include?('width')
24
+ shape.properties.size.width = property.split(':').last
25
+ when property.include?('height')
26
+ shape.properties.size.height = property.split(':').last
27
+ when property.include?('z-index')
28
+ shape.properties.z_index = property.split(':').last
29
+ when property.include?('position')
30
+ shape.properties.position = property.split(':').last
31
+ end
32
+ end
33
+ shape.properties.fill_color = Color.from_int16(shape_node.attribute('fillcolor').value.to_s.sub('#', '').split(' ').first) unless shape_node.attribute('fillcolor').nil?
34
+ shape.properties.stroke.weight = shape_node.attribute('strokeweight').value unless shape_node.attribute('strokeweight').nil?
35
+ shape.properties.stroke.color = Color.from_int16(shape_node.attribute('strokecolor').value.to_s.sub('#', '').split(' ').first) unless shape_node.attribute('strokecolor').nil?
36
+ shape.elements = TextBox.parse_list(shape_node.xpath('v:textbox').first, path) unless shape_node.xpath('v:textbox').first.nil?
37
+ shape
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,13 @@
1
+ # Class for parsing text outline and its properties
2
+ module OoxmlParser
3
+ class TextFill < OOXMLDocumentObject
4
+ attr_accessor :color_scheme
5
+
6
+ def self.parse(node)
7
+ text_fill = TextFill.new
8
+
9
+ text_fill.color_scheme = DocxColorScheme.parse(node)
10
+ text_fill
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ # Class for parsing text outline and its properties
2
+ module OoxmlParser
3
+ class TextOutline < OOXMLDocumentObject
4
+ attr_accessor :width, :color_scheme
5
+
6
+ def initialize
7
+ @width = 0
8
+ @color_scheme = :none
9
+ end
10
+
11
+ def self.parse(node)
12
+ text_outline = TextOutline.new
13
+
14
+ unless node.attribute('w').nil?
15
+ text_outline.width = (node.attribute('w').value.to_f / 12_699).round(2)
16
+ end
17
+
18
+ text_outline.color_scheme = DocxColorScheme.parse(node)
19
+ text_outline
20
+ end
21
+ end
22
+ end