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,77 @@
1
+ # Table Properties Data
2
+ require_relative 'properties/table_cell_margin'
3
+ require_relative 'properties/table_look'
4
+ require_relative 'properties/table_style'
5
+ require_relative 'properties/table_position'
6
+ module OoxmlParser
7
+ class TableProperties < OOXMLDocumentObject
8
+ attr_accessor :jc, :table_width, :shd, :table_borders, :table_properties, :table_positon, :table_cell_margin, :table_indent, :stretching, :table_style, :row_banding_size,
9
+ :column_banding_size, :table_look, :grid_column, :right_to_left, :style
10
+
11
+ alias table_properties table_positon
12
+
13
+ def initialize
14
+ @table_indent = nil
15
+ @table_cell_margin = nil
16
+ @jc = :left
17
+ @shd = nil
18
+ @stretching = true
19
+ @table_borders = Borders.new
20
+ @table_properties = nil
21
+ @table_width = nil
22
+ @grid_column = nil
23
+ @right_to_left = nil
24
+ @style = nil
25
+ end
26
+
27
+ def copy
28
+ table = TableProperties.new
29
+ table.jc = @jc
30
+ table.table_width = @table_width
31
+ table.shd = @shd
32
+ table.stretching = @stretching
33
+ table.table_borders = @table_borders.copy
34
+ table.table_properties = @table_properties
35
+ table.table_cell_margin = @table_cell_margin
36
+ table.table_indent = @table_indent
37
+ table.grid_column = @grid_column
38
+ table.right_to_left = @right_to_left
39
+ table.style = style
40
+ table
41
+ end
42
+
43
+ def self.parse(table_properties_node)
44
+ table_properties = TableProperties.new
45
+ table_properties_node.xpath('*').each do |table_props_node_child|
46
+ case table_props_node_child.name
47
+ when 'tableStyleId'
48
+ table_properties.style = TableStyle.parse(style_id: table_props_node_child.text)
49
+ when 'tblStyle'
50
+ style = DocxParagraphRun.get_style_by_id(table_props_node_child.attribute('val').value)
51
+ next if style.nil?
52
+ table_properties.table_style = TableStyle.parse(table_style_node: style)
53
+ when 'tblW'
54
+ table_properties.table_width = table_props_node_child.attribute('w').text.to_f / 567.0
55
+ when 'jc'
56
+ table_properties.jc = table_props_node_child.attribute('val').text.to_sym
57
+ when 'shd'
58
+ unless table_props_node_child.attribute('fill').nil?
59
+ background_color = Color.from_int16(table_props_node_child.attribute('fill').value)
60
+ table_properties.shd = background_color
61
+ end
62
+ when 'tblLook'
63
+ table_properties.table_look = TableLook.parse(table_props_node_child)
64
+ when 'tblInd'
65
+ table_properties.table_indent = table_props_node_child.attribute('w').text.to_f / 567.0
66
+ when 'tblpPr'
67
+ table_properties.table_positon = TablePosition.parse(table_props_node_child)
68
+ when 'tblCellMar'
69
+ table_properties.table_cell_margin = TableMargins.parse(table_props_node_child)
70
+ end
71
+ end
72
+ table_properties.table_look = TableLook.parse(table_properties_node) if table_properties.table_look.nil?
73
+ table_properties.right_to_left = OOXMLDocumentObject.option_enabled?(table_properties_node, 'rtl')
74
+ table_properties
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,41 @@
1
+ require_relative 'table/row/row'
2
+ require_relative 'table/table_properties'
3
+ require_relative 'table/table_grid'
4
+ require_relative 'table/margins/table_margins'
5
+ require_relative 'table/margins/paragraph_margins'
6
+ module OoxmlParser
7
+ class Table
8
+ attr_accessor :grid, :rows, :properties, :number
9
+
10
+ def initialize(rows = [])
11
+ @rows = rows
12
+ end
13
+
14
+ alias table_properties properties
15
+
16
+ def self.parse(table_node, number = 0, default_table_properties = TableProperties.new, default_paragraph = DocxParagraph.new, default_run = DocxParagraphRun.new)
17
+ table_properties = default_table_properties.copy
18
+ table_properties.jc = :left
19
+ table_paragraph = default_paragraph.copy
20
+ table_character = default_run.copy
21
+ table = Table.new
22
+ table_node.xpath('*').each do |table_node_child|
23
+ case table_node_child.name
24
+ when 'tblGrid'
25
+ table.grid = TableGrid.new
26
+ table_node_child.xpath('gridCol').each do |grid_col_node|
27
+ table.grid.columns << (grid_col_node.attribute('w').value.to_f / 360_000.0).round(2)
28
+ end
29
+ when 'tr'
30
+ table.rows << TableRow.parse(table_node_child)
31
+ when 'tblPr'
32
+ table.properties = TableProperties.parse(table_node_child)
33
+ when ''
34
+ DocxParagraph.parse_paragraph_style(table_node_child, table_paragraph, table_character)
35
+ end
36
+ end
37
+ table.number = number
38
+ table
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,40 @@
1
+ # Class for working Underline style parameter
2
+ module OoxmlParser
3
+ class Underline
4
+ attr_accessor :style, :color
5
+
6
+ def initialize(style = :none, color = nil)
7
+ @style = (style == 'single') ? :single : style
8
+ @color = color
9
+ end
10
+
11
+ def ==(other)
12
+ if other.is_a? Underline
13
+ @style.to_sym == other.style.to_sym && @color == other.color
14
+ elsif other.is_a? Symbol
15
+ @style.to_sym == other
16
+ else
17
+ false
18
+ end
19
+ end
20
+
21
+ def to_s
22
+ if @color.nil?
23
+ @style.to_s
24
+ else
25
+ "#{@style} #{@color}"
26
+ end
27
+ end
28
+
29
+ def self.parse(attribute_value)
30
+ underline = Underline.new
31
+ case attribute_value
32
+ when 'sng'
33
+ underline.style = :single
34
+ when 'none'
35
+ underline.style = :none
36
+ end
37
+ underline
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,7 @@
1
+ module OoxmlParser
2
+ # Common document structure for DOCX, XLSX, PPTX file
3
+ class CommonDocumentStructure < OOXMLDocumentObject
4
+ # @return [String] path to original file
5
+ attr_accessor :file_path
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ module OoxmlParser
2
+ class Configuration
3
+ attr_accessor :units
4
+
5
+ def initialize
6
+ @units = :centimeters
7
+ end
8
+
9
+ # @return [Float] by which divide units values
10
+ def units_delimiter
11
+ return (20 * 635.0) if @units == :points
12
+ return (566.929 * 635.0) if @units == :centimeters
13
+ return 1 if @units == :dxa
14
+ return 1440 if @units == :inches
15
+ return (1.0 / 635.0) if @units == :emu
16
+ warn "Cannot recognize #{@units} unit. Will use dxa by default"
17
+ 1
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ # Comment Data
2
+ module OoxmlParser
3
+ class Comment < OOXMLDocumentObject
4
+ attr_accessor :id, :paragraphs
5
+
6
+ def initialize(id = nil, paragraphs = [])
7
+ @id = id
8
+ @paragraphs = paragraphs
9
+ end
10
+
11
+ def self.parse_list
12
+ comments = []
13
+ comments_filename = "#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/comments.xml"
14
+ return [] unless File.exist?(comments_filename)
15
+ doc = Nokogiri::XML(File.open(comments_filename))
16
+ doc.search('//w:comments').each do |document|
17
+ document.xpath('w:comment').each do |comment_tag|
18
+ comment = Comment.new(comment_tag.attribute('id').value)
19
+ comment_tag.xpath('w:p').each_with_index do |p, index|
20
+ comment.paragraphs << DocxParagraph.parse(p, index)
21
+ end
22
+ comments << comment.dup
23
+ end
24
+ end
25
+ comments
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,10 @@
1
+ module OoxmlParser
2
+ class DocumentBackground
3
+ attr_accessor :color1, :size, :color2, :image, :type
4
+
5
+ def initialize(color1 = nil, type = 'simple')
6
+ @color1 = color1
7
+ @type = type
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,21 @@
1
+ # Document Properties
2
+ module OoxmlParser
3
+ class DocumentProperties < OOXMLDocumentObject
4
+ attr_accessor :pages, :words
5
+
6
+ def initialize(pages = nil, words = nil)
7
+ @pages = pages
8
+ @words = words
9
+ end
10
+
11
+ # Parse Document properties
12
+ # @return [DocumentProperties]
13
+ def self.parse
14
+ properties = DocumentProperties.new
15
+ doc_props = XmlSimple.xml_in(File.open("#{OOXMLDocumentObject.path_to_folder}docProps/app.xml"))
16
+ properties.pages = doc_props['Pages'].first.to_i unless doc_props['Pages'].nil?
17
+ properties.words = doc_props['Words'].first.to_i unless doc_props['Words'].nil?
18
+ properties
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,70 @@
1
+ module OoxmlParser
2
+ # Class for describing styles containing in +styles.xml+
3
+ class DocumentStyle < OOXMLDocumentObject
4
+ # @return [Symbol] Type of style (+:paragraph+ or +:table+)
5
+ attr_accessor :type
6
+ # @return [FixNum] number of style
7
+ attr_accessor :style_id
8
+ # @return [String] name of style
9
+ attr_accessor :name
10
+ # @return [FixNum] id of style on which this style is based
11
+ attr_accessor :based_on
12
+ # @return [FixNum] id of next style
13
+ attr_accessor :next_style
14
+ # @return [DocxParagraphRun] run properties
15
+ attr_accessor :run_properties
16
+ # @return [DocxParagraph] run properties
17
+ attr_accessor :paragraph_properties
18
+ # @return [True, False] Latent Style Primary Style Setting
19
+ # Used to determine if current style is visible in style list in editors
20
+ # According to http://www.wordarticles.com/Articles/WordStyles/LatentStyles.php
21
+ attr_accessor :q_format
22
+ alias visible? q_format
23
+
24
+ def initialize
25
+ @q_format = false
26
+ end
27
+
28
+ # Parse single document style
29
+ # @return [DocumentStyle]
30
+ def self.parse(node)
31
+ document_style = DocumentStyle.new
32
+ node.attributes.each do |key, value|
33
+ case key
34
+ when 'type'
35
+ document_style.type = value.value.to_sym
36
+ when 'styleId'
37
+ document_style.style_id = value.value.to_i
38
+ end
39
+ end
40
+ node.xpath('*').each do |subnode|
41
+ case subnode.name
42
+ when 'name'
43
+ document_style.name = subnode.attribute('val').value
44
+ when 'basedOn'
45
+ document_style.based_on = subnode.attribute('val').value.to_i
46
+ when 'next'
47
+ document_style.next_style = subnode.attribute('val').value.to_i
48
+ when 'rPr'
49
+ document_style.run_properties = DocxParagraphRun.parse(subnode)
50
+ when 'pPr'
51
+ document_style.paragraph_properties = DocxParagraph.parse_paragraph_style(subnode)
52
+ when 'qFormat'
53
+ document_style.q_format = true
54
+ end
55
+ end
56
+ document_style
57
+ end
58
+
59
+ # Parse all document style list
60
+ # @return [Array, DocumentStyle]
61
+ def self.parse_list
62
+ styles_array = []
63
+ doc = Nokogiri::XML(File.open(OOXMLDocumentObject.path_to_folder + 'word/styles.xml'))
64
+ doc.search('//w:style').each do |style|
65
+ styles_array << DocumentStyle.parse(style)
66
+ end
67
+ styles_array
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,11 @@
1
+ # Accent Data
2
+ module OoxmlParser
3
+ class Accent
4
+ attr_accessor :symbol, :element
5
+
6
+ def initialize(symbol = nil, element = nil)
7
+ @symbol = symbol
8
+ @element = element
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module OoxmlParser
2
+ class Bar
3
+ attr_accessor :position, :element
4
+
5
+ def initialize(position = 'bottom', element = nil)
6
+ @position = position
7
+ @element = element
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # Box data
2
+ module OoxmlParser
3
+ class Box
4
+ attr_accessor :borders, :element
5
+
6
+ def initialize(borders = false, element = nil)
7
+ @borders = borders
8
+ @element = element
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ # Delimiter Data
2
+ module OoxmlParser
3
+ class Delimiter
4
+ attr_accessor :begin_character, :value, :end_character
5
+
6
+ def initialize(begin_character = '(', value = nil, end_character = ')')
7
+ @begin_character = begin_character
8
+ @value = value
9
+ @end_character = end_character
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ # Fraction Data
2
+ module OoxmlParser
3
+ class Fraction
4
+ attr_accessor :numerator, :denominator
5
+
6
+ def initialize(numerator = nil, denominator = nil)
7
+ @numerator = numerator
8
+ @denominator = denominator
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # Function Data
2
+ module OoxmlParser
3
+ class Function
4
+ attr_accessor :name, :argument
5
+
6
+ def initialize(name = nil, argument = nil)
7
+ @name = name
8
+ @argument = argument
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ # Group Char Data
2
+ module OoxmlParser
3
+ class GroupChar
4
+ attr_accessor :symbol, :position, :vertical_align, :element
5
+
6
+ def initialize(symbol = nil, position = nil, vertical_align = nil, element = nil)
7
+ @symbol = symbol
8
+ @position = position
9
+ @vertical_align = vertical_align
10
+ @element = element
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ # Index data
2
+ module OoxmlParser
3
+ class Index
4
+ attr_accessor :value, :top_index, :bottom_index
5
+
6
+ def initialize(value = nil, bottom_index = nil, top_index = nil)
7
+ @value = value
8
+ @bottom_index = bottom_index
9
+ @top_index = top_index
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # Limit Data
2
+ module OoxmlParser
3
+ class Limit
4
+ attr_accessor :type, :element, :limit
5
+
6
+ def initialize(type = nil, element = nil, limit = nil)
7
+ @type = type
8
+ @element = element
9
+ @limit = limit
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ # Matrix Row data
2
+ module OoxmlParser
3
+ class MatrixRow
4
+ attr_accessor :columns
5
+
6
+ def initialize(columns_count = 1)
7
+ @columns = Array.new(columns_count)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require_relative 'matrix/matrix_row'
2
+ module OoxmlParser
3
+ class Matrix
4
+ attr_accessor :rows
5
+
6
+ def initialize(rows = [])
7
+ @rows = rows
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ # Operator Data
2
+ module OoxmlParser
3
+ class Operator
4
+ attr_accessor :operator, :bottom_value, :top_value, :value
5
+
6
+ def initialize(operator = nil, bottom_value = nil, top_value = nil, value = nil)
7
+ @operator = operator
8
+ @bottom_value = bottom_value
9
+ @top_value = top_value
10
+ @value = value
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ # Radical Data
2
+ module OoxmlParser
3
+ class Radical
4
+ attr_accessor :degree, :value
5
+
6
+ def initialize(degree = 2, value = nil)
7
+ @degree = degree
8
+ @value = value
9
+ end
10
+ end
11
+ end