ooxml_parser 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (315) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -5
  3. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/chart_style.rb +19 -0
  4. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +18 -0
  5. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +19 -0
  6. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +20 -0
  7. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +20 -14
  8. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/order.rb +20 -0
  9. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_index.rb +20 -0
  10. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point/text_value.rb +15 -0
  11. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point.rb +31 -0
  12. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point_count.rb +20 -0
  13. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache.rb +31 -0
  14. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference.rb +25 -0
  15. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +23 -0
  16. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +39 -0
  17. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/view_3d.rb +32 -0
  18. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +81 -74
  19. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +20 -13
  20. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +15 -14
  21. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +15 -12
  22. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +15 -10
  23. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +22 -11
  24. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing/doc_properties.rb +24 -0
  25. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +34 -20
  26. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +9 -10
  27. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +18 -25
  28. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +4 -1
  29. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +23 -20
  30. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +15 -5
  31. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +104 -0
  32. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb +17 -0
  33. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_horizontal.rb +31 -0
  34. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_vertical.rb +30 -0
  35. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +17 -16
  36. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +34 -0
  37. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +12 -15
  38. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +15 -10
  39. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb +38 -0
  40. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties/shape_placeholder.rb +21 -0
  41. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb +29 -0
  42. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb +22 -0
  43. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +29 -0
  44. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +26 -0
  45. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +27 -10
  46. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties/preset_text_warp.rb +7 -4
  47. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +20 -11
  48. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +18 -15
  49. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +11 -9
  50. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb +39 -0
  51. 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 +15 -27
  52. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +13 -9
  53. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +20 -23
  54. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +27 -22
  55. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip/alpha_mod_fix.rb +19 -0
  56. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip.rb +21 -0
  57. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill.rb +24 -0
  58. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list/shape_guide.rb +24 -0
  59. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list.rb +31 -0
  60. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry.rb +24 -0
  61. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +3 -3
  62. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +22 -13
  63. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +20 -12
  64. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +9 -8
  65. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +15 -13
  66. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +14 -12
  67. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +15 -12
  68. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +18 -14
  69. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +12 -11
  70. data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +20 -24
  71. data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +25 -0
  72. data/lib/ooxml_parser/common_parser/common_data/color.rb +48 -182
  73. data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +15 -10
  74. data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +1 -63
  75. data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +17 -20
  76. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop/preset_color.rb +20 -0
  77. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +20 -7
  78. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +12 -11
  79. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +17 -17
  80. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +15 -9
  81. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +19 -16
  82. data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +10 -6
  83. data/lib/ooxml_parser/common_parser/common_data/font_style.rb +1 -61
  84. data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +33 -26
  85. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +97 -0
  86. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +23 -37
  87. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +71 -23
  88. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/language.rb +20 -0
  89. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +11 -7
  90. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb +20 -0
  91. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb +20 -0
  92. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb +25 -0
  93. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +38 -0
  94. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb +20 -0
  95. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +92 -40
  96. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +12 -8
  97. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +37 -0
  98. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +53 -0
  99. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +36 -0
  100. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +6 -6
  101. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tab_list/presentation_tab.rb +26 -0
  102. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tab_list.rb +36 -0
  103. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/paragraph_tab.rb +26 -0
  104. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +36 -0
  105. data/lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb +11 -8
  106. data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +20 -12
  107. data/lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb +13 -7
  108. data/lib/ooxml_parser/common_parser/common_data/relationships.rb +36 -4
  109. data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +12 -8
  110. data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +18 -19
  111. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +9 -8
  112. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_layout.rb +23 -0
  113. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +17 -14
  114. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +16 -23
  115. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +21 -40
  116. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb +23 -0
  117. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +42 -0
  118. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +50 -0
  119. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_row_band_size.rb +23 -0
  120. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +28 -23
  121. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties/vertical_merge.rb +20 -0
  122. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +71 -69
  123. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb +18 -10
  124. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +19 -17
  125. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +31 -48
  126. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line/line_join.rb +21 -0
  127. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +25 -19
  128. data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties/table_row_height.rb +20 -0
  129. data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +20 -10
  130. data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +20 -16
  131. data/lib/ooxml_parser/common_parser/common_data/table/table_grid/grid_column.rb +20 -0
  132. data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +27 -3
  133. data/lib/ooxml_parser/common_parser/common_data/table/table_properties/table_borders.rb +20 -13
  134. data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +54 -37
  135. data/lib/ooxml_parser/common_parser/common_data/table.rb +23 -17
  136. data/lib/ooxml_parser/common_parser/common_data/underline.rb +13 -10
  137. data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +29 -0
  138. data/lib/ooxml_parser/common_parser/parser.rb +32 -4
  139. data/lib/ooxml_parser/configuration.rb +3 -13
  140. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb +1 -1
  141. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +16 -16
  142. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +18 -13
  143. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +20 -0
  144. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb +18 -0
  145. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb +37 -0
  146. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +43 -14
  147. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark.rb +21 -0
  148. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +19 -5
  149. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties/argument_size.rb +20 -0
  150. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties.rb +21 -0
  151. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +24 -4
  152. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +14 -5
  153. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +27 -6
  154. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +15 -5
  155. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +14 -5
  156. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +23 -7
  157. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +16 -6
  158. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +20 -6
  159. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +25 -0
  160. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb +25 -0
  161. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +4 -3
  162. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +36 -3
  163. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_grow.rb +20 -0
  164. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_limit_location.rb +20 -0
  165. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties.rb +26 -0
  166. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary.rb +31 -0
  167. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +27 -0
  168. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +19 -5
  169. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +52 -183
  170. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +89 -0
  171. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb +23 -0
  172. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object.rb +21 -0
  173. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +24 -17
  174. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +7 -6
  175. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +15 -10
  176. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +43 -245
  177. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +19 -20
  178. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +24 -65
  179. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb +41 -0
  180. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +31 -0
  181. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +146 -172
  182. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +45 -26
  183. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/multilevel_type.rb +20 -0
  184. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_justification.rb +20 -0
  185. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_text.rb +20 -0
  186. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/numbering_format.rb +20 -0
  187. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/start.rb +20 -0
  188. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +31 -0
  189. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +65 -0
  190. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +42 -0
  191. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition/abstract_numbering_id.rb +20 -0
  192. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition.rb +31 -0
  193. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +45 -0
  194. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +15 -4
  195. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +24 -13
  196. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +6 -12
  197. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/footnote_properties.rb +32 -0
  198. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +8 -9
  199. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +31 -24
  200. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +61 -64
  201. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +56 -0
  202. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/paragraph_properties_default.rb +20 -0
  203. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/run_properties_default.rb +20 -0
  204. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb +26 -0
  205. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +19 -0
  206. data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +49 -54
  207. data/lib/ooxml_parser/docx_parser/docx_parser.rb +2 -1
  208. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment.rb +1 -1
  209. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_helpers.rb +13 -0
  210. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +15 -12
  211. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +1 -1
  212. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties/stretch.rb +11 -0
  213. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties.rb +21 -0
  214. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +19 -6
  215. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +27 -16
  216. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +13 -9
  217. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +11 -8
  218. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +19 -15
  219. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +17 -12
  220. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +15 -14
  221. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +18 -15
  222. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +9 -11
  223. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition.rb +16 -13
  224. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +23 -15
  225. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +21 -19
  226. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +15 -11
  227. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +52 -0
  228. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +13 -7
  229. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb +11 -9
  230. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +13 -15
  231. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +9 -14
  232. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +30 -67
  233. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +11 -8
  234. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +6 -3
  235. data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +1 -1
  236. data/lib/ooxml_parser/version.rb +1 -1
  237. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +28 -0
  238. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb +33 -0
  239. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +25 -0
  240. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +38 -0
  241. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +35 -0
  242. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +38 -0
  243. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats/number_format.rb +24 -0
  244. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +47 -0
  245. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +36 -0
  246. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb +11 -0
  247. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +11 -10
  248. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +8 -10
  249. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb +12 -12
  250. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +12 -10
  251. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +29 -8
  252. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb +24 -0
  253. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +21 -0
  254. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +30 -0
  255. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb +37 -0
  256. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +29 -10
  257. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb +25 -0
  258. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +23 -29
  259. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb +15 -12
  260. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style.rb +70 -37
  261. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +16 -12
  262. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +31 -9
  263. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +34 -12
  264. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +20 -9
  265. data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +1 -1
  266. data/lib/ooxml_parser.rb +0 -1
  267. metadata +122 -58
  268. data/lib/ooxml_parser/common_parser/common_data/alingment.rb +0 -56
  269. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_style/office_2007_chart_style.rb +0 -17
  270. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_style/office_2010_chart_style.rb +0 -17
  271. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/group/docx_group_element.rb +0 -10
  272. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/group/docx_grouped_drawing.rb +0 -34
  273. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_gradient_color.rb +0 -30
  274. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_single_gradient_color.rb +0 -6
  275. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/solid_color/docx_solid_color.rb +0 -10
  276. 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 +0 -10
  277. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end/line_size.rb +0 -20
  278. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_style/docx_shape_style.rb +0 -5
  279. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/common_non_visual_properties.rb +0 -25
  280. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/non_visual_properties.rb +0 -19
  281. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/non_visual_shape_properties.rb +0 -20
  282. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape.rb +0 -28
  283. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_placeholder.rb +0 -18
  284. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/ooxml_shift.rb +0 -15
  285. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/transform_effect.rb +0 -28
  286. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties.rb +0 -13
  287. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/ooxml_text_box.rb +0 -26
  288. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/text_body.rb +0 -23
  289. data/lib/ooxml_parser/common_parser/common_data/colors/image/stretching/fill_rectangle.rb +0 -22
  290. data/lib/ooxml_parser/common_parser/common_data/colors/image/stretching.rb +0 -12
  291. data/lib/ooxml_parser/common_parser/common_data/colors/image_properties.rb +0 -16
  292. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/strikeout.rb +0 -16
  293. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering/numbering_properties/numbering_level.rb +0 -25
  294. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering/numbering_properties.rb +0 -69
  295. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering.rb +0 -18
  296. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_cell_margin.rb +0 -20
  297. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_elements.rb +0 -21
  298. data/lib/ooxml_parser/common_parser/common_data/table/properties/whole_table/line_join.rb +0 -19
  299. data/lib/ooxml_parser/common_parser/common_data/table/properties/whole_table/table_cell_style.rb +0 -20
  300. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/operator.rb +0 -13
  301. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/bookmark.rb +0 -10
  302. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/paragraph_tab.rb +0 -19
  303. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb +0 -35
  304. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb +0 -56
  305. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/image.rb +0 -15
  306. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/size.rb +0 -84
  307. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping/grouping_properties.rb +0 -16
  308. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character/excel_comment_character_properties.rb +0 -27
  309. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character.rb +0 -25
  310. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position/xlsx_drawing_position_parameters.rb +0 -22
  311. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position.rb +0 -22
  312. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb +0 -37
  313. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/foreground_color.rb +0 -25
  314. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/ooxml_font.rb +0 -36
  315. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_table.rb +0 -30
@@ -1,21 +1,21 @@
1
- # Class for storing SheetFormatProperties
2
1
  module OoxmlParser
3
- class SheetFormatProperties
2
+ # Class for storing SheetFormatProperties
3
+ class SheetFormatProperties < OOXMLDocumentObject
4
4
  attr_accessor :default_column_width, :default_row_height
5
5
 
6
- def initialize(column_width = nil, row_height = nil)
7
- @default_column_width = column_width
8
- @default_row_height = row_height
9
- end
10
-
11
6
  # Parse SheetFormatProperties
12
7
  # @param node [Nokogiri::XML::Element] node to parse
13
8
  # @return [SheetFormatProperties] value of SheetFormatProperties
14
- def self.parse(node)
15
- format_properties = SheetFormatProperties.new
16
- format_properties.default_column_width = node.attribute('defaultColWidth').value.to_f
17
- format_properties.default_row_height = node.attribute('defaultRowHeight').value.to_f
18
- format_properties
9
+ def parse(node)
10
+ node.attributes.each do |key, value|
11
+ case key
12
+ when 'defaultColWidth'
13
+ @default_column_width = value.value.to_f
14
+ when 'defaultRowHeight'
15
+ @default_row_height = value.value.to_f
16
+ end
17
+ end
18
+ self
19
19
  end
20
20
  end
21
21
  end
@@ -1,23 +1,25 @@
1
- # XLSX data of pane
2
1
  module OoxmlParser
3
- class Pane
2
+ # Class for `pane` data
3
+ class Pane < OOXMLDocumentObject
4
4
  attr_accessor :state, :top_left_cell, :x_split, :y_split
5
5
 
6
- def self.parse(pane_node)
7
- pane = Pane.new
8
- pane_node.attributes.each do |key, value|
6
+ # Parse Pane object
7
+ # @param node [Nokogiri::XML:Element] node to parse
8
+ # @return [Pane] result of parsing
9
+ def parse(node)
10
+ node.attributes.each do |key, value|
9
11
  case key
10
12
  when 'state'
11
- pane.state = value.value.to_sym
13
+ @state = value.value.to_sym
12
14
  when 'topLeftCell'
13
- pane.top_left_cell = Coordinates.parse_coordinates_from_string(value.value)
15
+ @top_left_cell = Coordinates.parse_coordinates_from_string(value.value)
14
16
  when 'xSplit'
15
- pane.x_split = value.value
17
+ @x_split = value.value
16
18
  when 'ySplit'
17
- pane.y_split = value.value
19
+ @y_split = value.value
18
20
  end
19
21
  end
20
- pane
22
+ self
21
23
  end
22
24
  end
23
25
  end
@@ -1,18 +1,39 @@
1
1
  require_relative 'sheet_view/pane'
2
- # Class for Sheet View
3
2
  module OoxmlParser
4
- class SheetView
3
+ # Class for `sheetView` data
4
+ class SheetView < OOXMLDocumentObject
5
5
  attr_accessor :pane
6
+ # @return [True, False] Flag indicating whether this sheet should display gridlines.
7
+ attr_accessor :show_gridlines
8
+ # @return [True, False] Flag indicating whether the sheet should display row and column headings.
9
+ attr_accessor :show_row_column_headers
6
10
 
7
- def self.parse(sheet_view_node)
8
- sheet_view = SheetView.new
9
- sheet_view_node.xpath('*').each do |sheet_view_node_child|
10
- case sheet_view_node_child.name
11
+ def initialize(parent: nil)
12
+ @parent = parent
13
+ @show_gridlines = true
14
+ @show_row_column_headers = true
15
+ end
16
+
17
+ # Parse SheetView object
18
+ # @param node [Nokogiri::XML:Element] node to parse
19
+ # @return [SheetView] result of parsing
20
+ def parse(node)
21
+ node.attributes.each do |key, _value|
22
+ case key
23
+ when 'showGridLines'
24
+ @show_gridlines = attribute_enabled?(node, key)
25
+ when 'showRowColHeaders'
26
+ @show_row_column_headers = attribute_enabled?(node, key)
27
+ end
28
+ end
29
+
30
+ node.xpath('*').each do |node_child|
31
+ case node_child.name
11
32
  when 'pane'
12
- sheet_view.pane = Pane.parse(sheet_view_node_child)
33
+ @pane = Pane.new(parent: self).parse(node_child)
13
34
  end
14
35
  end
15
- sheet_view
36
+ self
16
37
  end
17
38
  end
18
39
  end
@@ -0,0 +1,24 @@
1
+ module OoxmlParser
2
+ # Class for `x14:table` data
3
+ class X14Table < OOXMLDocumentObject
4
+ # @return [String] alternate text for table
5
+ attr_accessor :alt_text
6
+ # @return [String] alternate text summary table
7
+ attr_accessor :alt_text_summary
8
+
9
+ # Parse X14Table data
10
+ # @param [Nokogiri::XML:Element] node with X14Table data
11
+ # @return [X14Table] value of X14Table data
12
+ def parse(node)
13
+ node.attributes.each do |key, value|
14
+ case key
15
+ when 'altText'
16
+ @alt_text = value.value.to_s
17
+ when 'altTextSummary'
18
+ @alt_text_summary = value.value.to_s
19
+ end
20
+ end
21
+ self
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,21 @@
1
+ require_relative 'extension/x14_table'
2
+ module OoxmlParser
3
+ # Class for `ext` data
4
+ class Extension < OOXMLDocumentObject
5
+ # @return [X14Table] table data in x14 namespace
6
+ attr_accessor :table
7
+
8
+ # Parse Extension data
9
+ # @param [Nokogiri::XML:Element] node with Extension data
10
+ # @return [Extension] value of Extension data
11
+ def parse(node)
12
+ node.xpath('*').each do |column_node|
13
+ case column_node.name
14
+ when 'table'
15
+ @table = X14Table.new(parent: self).parse(column_node)
16
+ end
17
+ end
18
+ self
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,30 @@
1
+ require_relative 'extension_list/extension'
2
+ module OoxmlParser
3
+ # Class for `extLst` data
4
+ class ExtensionList < OOXMLDocumentObject
5
+ attr_accessor :extension_array
6
+
7
+ def initialize(parent: nil)
8
+ @extension_array = []
9
+ @parent = parent
10
+ end
11
+
12
+ # @return [Array, Extension] accessor
13
+ def [](key)
14
+ @extension_array[key]
15
+ end
16
+
17
+ # Parse ExtensionList data
18
+ # @param [Nokogiri::XML:Element] node with ExtensionList data
19
+ # @return [ExtensionList] value of ExtensionList data
20
+ def parse(node)
21
+ node.xpath('*').each do |column_node|
22
+ case column_node.name
23
+ when 'ext'
24
+ @extension_array << Extension.new(parent: self).parse(column_node)
25
+ end
26
+ end
27
+ self
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,37 @@
1
+ require_relative 'table_part/extension_list'
2
+ module OoxmlParser
3
+ # Class for `tablePart` data
4
+ class TablePart < OOXMLDocumentObject
5
+ attr_accessor :name, :display_name, :reference, :autofilter, :columns
6
+ # @return [ExtensionList] list of extensions
7
+ attr_accessor :extension_list
8
+
9
+ # Parse TablePart object
10
+ # @param node [Nokogiri::XML:Element] node to parse
11
+ # @return [TablePart] result of parsing
12
+ def parse(node)
13
+ link_to_table_part_xml = OOXMLDocumentObject.get_link_from_rels(node.attribute('id').value)
14
+ doc = Nokogiri::XML(File.open(OOXMLDocumentObject.path_to_folder + link_to_table_part_xml.gsub('..', 'xl')))
15
+ table_node = doc.xpath('xmlns:table').first
16
+ table_node.attributes.each do |key, value|
17
+ case key
18
+ when 'name'
19
+ @name = value.value.to_s
20
+ when 'displayName'
21
+ @display_name = value.value.to_s
22
+ when 'ref'
23
+ @reference = Coordinates.parser_coordinates_range value.value.to_s
24
+ end
25
+ end
26
+ table_node.xpath('*').each do |node_child|
27
+ case node_child.name
28
+ when 'autoFilter'
29
+ @autofilter = Coordinates.parser_coordinates_range node_child.attribute('ref').value
30
+ when 'extLst'
31
+ @extension_list = ExtensionList.new(parent: self).parse(node_child)
32
+ end
33
+ end
34
+ self
35
+ end
36
+ end
37
+ end
@@ -1,21 +1,40 @@
1
- # Properties of XLSX column
2
1
  module OoxmlParser
2
+ # Properties of XLSX column
3
3
  class XlsxColumnProperties < OOXMLDocumentObject
4
4
  attr_accessor :from, :to, :width, :style
5
+ # @return [True, False] is width custom
6
+ attr_accessor :custom_width
7
+ # @return [True, False] Flag indicating if the
8
+ # specified column(s) is set to 'best fit'
9
+ attr_accessor :best_fit
5
10
 
6
- def self.parse(col_node)
7
- col = XlsxColumnProperties.new
8
- col.from = col_node.attribute('min').value.to_i
9
- col.to = col_node.attribute('max').value.to_i
10
- col.style = CellStyle.parse(col_node.attribute('style').value) unless col_node.attribute('style').nil?
11
- col.width = col_node.attribute('width').value.to_f - 0.7109375 if OOXMLDocumentObject.option_enabled?(col_node, 'customWidth')
12
- col
11
+ # Parse XlsxColumnProperties object
12
+ # @param node [Nokogiri::XML:Element] node to parse
13
+ # @return [XlsxColumnProperties] result of parsing
14
+ def parse(node)
15
+ node.attributes.each do |key, value|
16
+ case key
17
+ when 'min'
18
+ @from = value.value.to_i
19
+ when 'max'
20
+ @to = value.value.to_i
21
+ when 'style'
22
+ @style = CellStyle.new(parent: self).parse(value.value)
23
+ when 'width'
24
+ @width = value.value.to_f - 0.7109375
25
+ when 'customWidth'
26
+ @custom_width = option_enabled?(node, 'customWidth')
27
+ when 'bestFit'
28
+ @best_fit = attribute_enabled?(value)
29
+ end
30
+ end
31
+ self
13
32
  end
14
33
 
15
- def self.parse_list(columns_width_node)
34
+ def self.parse_list(columns_width_node, parent: nil)
16
35
  columns = []
17
36
  columns_width_node.xpath('xmlns:col').each do |col_node|
18
- col = XlsxColumnProperties.parse(col_node)
37
+ col = XlsxColumnProperties.new(parent: parent).parse(col_node)
19
38
  columns << col
20
39
  end
21
40
  columns
@@ -0,0 +1,25 @@
1
+ module OoxmlParser
2
+ # Class for parsing offset of drawing `xdr:from`, `xdr:to`
3
+ class XlsxDrawingPositionParameters < OOXMLDocumentObject
4
+ attr_accessor :column, :column_offset, :row, :row_offset
5
+
6
+ # Parse XlsxDrawingPositionParameters object
7
+ # @param node [Nokogiri::XML:Element] node to parse
8
+ # @return [XlsxDrawingPositionParameters] result of parsing
9
+ def parse(node)
10
+ node.xpath('*').each do |node_child|
11
+ case node_child.name
12
+ when 'col'
13
+ @column = Coordinates.get_column_name(node_child.text.to_i + 1)
14
+ when 'colOff'
15
+ @column_offset = OoxmlSize.new(node_child.text.to_f, :emu)
16
+ when 'row'
17
+ @row = node_child.text.to_i + 1
18
+ when 'rowOff'
19
+ @row_offset = OoxmlSize.new(node_child.text.to_f, :emu)
20
+ end
21
+ end
22
+ self
23
+ end
24
+ end
25
+ end
@@ -1,49 +1,43 @@
1
- require_relative 'xlsx_drawing/xlsx_drawing_position'
2
- require_relative 'xlsx_drawing/xlsx_shape_grouping'
1
+ require_relative 'xlsx_drawing/xlsx_drawing_position_parameters'
3
2
  module OoxmlParser
4
3
  class XlsxDrawing < OOXMLDocumentObject
5
- attr_accessor :position, :picture, :shape, :grouping
4
+ attr_accessor :picture, :shape, :grouping
5
+ # @return [XlsxDrawingPositionParameters] position from
6
+ attr_accessor :from
7
+ # @return [XlsxDrawingPositionParameters] position to
8
+ attr_accessor :to
6
9
 
7
- def initialize(position = XlsxDrawingPosition.new)
8
- @position = position
9
- end
10
-
11
- def self.parse(drawing_node)
12
- drawing = XlsxDrawing.new
13
- drawing.position = XlsxDrawingPosition.parse(drawing_node)
14
- drawing_node.xpath('*').each do |drawing_node_child|
15
- case drawing_node_child.name
10
+ # Parse XlsxDrawing object
11
+ # @param node [Nokogiri::XML:Element] node to parse
12
+ # @return [XlsxDrawing] result of parsing
13
+ def parse(node)
14
+ node.xpath('*').each do |child_node|
15
+ case child_node.name
16
+ when 'from'
17
+ @from = XlsxDrawingPositionParameters.new(parent: self).parse(child_node)
18
+ when 'to'
19
+ @to = XlsxDrawingPositionParameters.new(parent: self).parse(child_node)
16
20
  when 'sp'
17
- drawing.shape = DocxShape.parse(drawing_node_child)
21
+ @shape = DocxShape.new(parent: self).parse(child_node)
18
22
  when 'grpSp'
19
- drawing.grouping = XlsxShapeGrouping.parse(drawing_node_child)
23
+ @grouping = ShapesGrouping.new(parent: self).parse(child_node)
20
24
  when 'pic'
21
- drawing.picture = DocxPicture.parse(drawing_node_child)
25
+ @picture = DocxPicture.new(parent: self).parse(child_node)
22
26
  when 'graphicFrame'
23
- drawing.picture = DocxPicture.new
24
- graphic_data_node = drawing_node_child.xpath('a:graphic/a:graphicData', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main')
27
+ @picture = DocxPicture.new
28
+ graphic_data_node = child_node.xpath('a:graphic/a:graphicData', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main')
25
29
  graphic_data_node.xpath('*').each do |graphic_data_node_child|
26
30
  case graphic_data_node_child.name
27
31
  when 'chart'
28
32
  path_to_chart_xml = OOXMLDocumentObject.get_link_from_rels(graphic_data_node_child.attribute('id').value)
29
33
  OOXMLDocumentObject.add_to_xmls_stack(path_to_chart_xml)
30
- drawing.picture.chart = Chart.parse
34
+ @picture.chart = Chart.parse
31
35
  OOXMLDocumentObject.xmls_stack.pop
32
36
  end
33
37
  end
34
38
  end
35
39
  end
36
- drawing
37
- end
38
-
39
- def self.parse_list(worksheet)
40
- drawing_node = Nokogiri::XML(File.open(OOXMLDocumentObject.current_xml))
41
- drawing_node.xpath('xdr:wsDr/*').each do |drawing_node_child|
42
- case drawing_node_child.name
43
- when 'twoCellAnchor'
44
- worksheet.drawings << XlsxDrawing.parse(drawing_node_child)
45
- end
46
- end
40
+ self
47
41
  end
48
42
  end
49
43
  end
@@ -1,30 +1,33 @@
1
- # Character Alignment in XLSX
2
1
  module OoxmlParser
3
- class XlsxAlignment
2
+ # Character Alignment in XLSX
3
+ class XlsxAlignment < OOXMLDocumentObject
4
4
  attr_accessor :horizontal, :vertical, :wrap_text, :text_rotation
5
5
 
6
- def initialize(horizontal = :left, vertical = :bottom, wrap_text = false)
6
+ def initialize(horizontal = :left, vertical = :bottom, wrap_text = false, parent: nil)
7
7
  @horizontal = horizontal
8
8
  @vertical = vertical
9
9
  @wrap_text = wrap_text
10
+ @parent = parent
10
11
  end
11
12
 
12
- def self.parse(alignment_node)
13
- alignment = XlsxAlignment.new
14
- alignment_node.attributes.each do |key, value|
13
+ # Parse XlsxAlignment object
14
+ # @param node [Nokogiri::XML:Element] node to parse
15
+ # @return [XlsxAlignment] result of parsing
16
+ def parse(node)
17
+ node.attributes.each do |key, value|
15
18
  case key
16
19
  when 'horizontal'
17
- alignment.horizontal = value.value.to_sym
18
- alignment.wrap_text = true if alignment.horizontal == :justify
20
+ @horizontal = value.value.to_sym
21
+ @wrap_text = true if @horizontal == :justify
19
22
  when 'vertical'
20
- alignment.vertical = value.value.to_sym
23
+ @vertical = value.value.to_sym
21
24
  when 'wrapText'
22
- alignment.wrap_text = value.value.to_s == '1'
25
+ @wrap_text = value.value.to_s == '1'
23
26
  when 'textRotation'
24
- alignment.text_rotation = value.value.to_i
27
+ @text_rotation = value.value.to_i
25
28
  end
26
29
  end
27
- alignment
30
+ self
28
31
  end
29
32
  end
30
33
  end
@@ -1,7 +1,6 @@
1
- require_relative 'cell_style/foreground_color'
2
1
  require_relative 'cell_style/alignment'
3
- require_relative 'cell_style/ooxml_font'
4
2
  module OoxmlParser
3
+ # Class for parsing cell style
5
4
  class CellStyle < OOXMLDocumentObject
6
5
  ALL_FORMAT_VALUE = %w|0 0.00 #,##0 #,##0.00 $#,##0_);($#,##0) $#,##0_);[Red]($#,##0) $#,##0.00_);($#,##0.00)
7
6
  $#,##0.00_);[Red]($#,##0.00)
@@ -49,47 +48,81 @@ module OoxmlParser
49
48
  attr_accessor :font, :borders, :fill_color, :numerical_format, :alignment
50
49
  # @return [True, False] check if style should add QuotePrefix (' symbol) to start of the string
51
50
  attr_accessor :quote_prefix
51
+ # @return [True, False] is font applied
52
+ attr_accessor :apply_font
53
+ # @return [True, False] is border applied
54
+ attr_accessor :apply_border
55
+ # @return [True, False] is fill applied
56
+ attr_accessor :apply_fill
57
+ # @return [True, False] is number format applied
58
+ attr_accessor :apply_number_format
59
+ # @return [True, False] is alignment applied
60
+ attr_accessor :apply_alignment
61
+ # @return [Integer] id of font
62
+ attr_accessor :font_id
63
+ # @return [Integer] id of border
64
+ attr_accessor :border_id
65
+ # @return [Integer] id of fill
66
+ attr_accessor :fill_id
67
+ # @return [Integer] id of number format
68
+ attr_accessor :number_format_id
52
69
 
53
- def initialize(font = nil, borders = nil, fill_color = ForegroundColor.new, numerical_format = 'General', alignment = nil)
54
- @font = font
55
- @borders = borders
56
- @fill_color = fill_color
57
- @numerical_format = numerical_format
58
- @alignment = alignment
70
+ def initialize(parent: nil)
71
+ @numerical_format = 'General'
72
+ @alignment = XlsxAlignment.new
73
+ @parent = parent
59
74
  end
60
75
 
61
- def self.parse(style_number)
62
- current_cell_style = XLSXWorkbook.styles_node.xpath('//xmlns:cellXfs/xmlns:xf')[style_number.to_i]
63
- cell_style = CellStyle.new
64
- cell_style.alignment = XlsxAlignment.new
65
- cell_style.font = if current_cell_style.attribute('applyFont').nil? || current_cell_style.attribute('applyFont').value == '0'
66
- OOXMLFont.parse(0)
67
- else
68
- OOXMLFont.parse(current_cell_style.attribute('fontId').value.to_i)
69
- end
70
- unless current_cell_style.attribute('applyBorder').nil? || current_cell_style.attribute('applyBorder').value == '0'
71
- cell_style.borders = Borders.parse_from_style(current_cell_style.attribute('borderId').value.to_i)
72
- end
73
- unless current_cell_style.attribute('applyFill').nil? || current_cell_style.attribute('applyFill').value == '0'
74
- cell_style.fill_color = ForegroundColor.parse(current_cell_style.attribute('fillId').value.to_i)
75
- end
76
- unless current_cell_style.attribute('applyNumberFormat').nil? || current_cell_style.attribute('applyNumberFormat').value == '0'
77
- format_id = current_cell_style.attribute('numFmtId').value.to_i
78
- XLSXWorkbook.styles_node.xpath('//xmlns:numFmt').each do |numeric_format|
79
- if format_id == numeric_format.attribute('numFmtId').value.to_i
80
- cell_style.numerical_format = numeric_format.attribute('formatCode').value
81
- elsif CellStyle::ALL_FORMAT_VALUE[format_id - 1]
82
- cell_style.numerical_format = CellStyle::ALL_FORMAT_VALUE[format_id - 1]
83
- end
76
+ # Parse CellStyle object
77
+ # @param node [Nokogiri::XML:Element] node to parse
78
+ # @return [CellStyle] result of parsing
79
+ def parse(node)
80
+ style_node = XLSXWorkbook.styles_node.xpath('//xmlns:cellXfs/xmlns:xf')[node.to_i]
81
+ style_node.attributes.each do |key, value|
82
+ case key
83
+ when 'applyFont'
84
+ @apply_font = attribute_enabled?(value)
85
+ when 'applyBorder'
86
+ @apply_border = attribute_enabled?(value)
87
+ when 'applyFill'
88
+ @apply_fill = attribute_enabled?(value)
89
+ when 'applyNumberFormat'
90
+ @apply_number_format = attribute_enabled?(value)
91
+ when 'applyAlignment'
92
+ @apply_alignment = attribute_enabled?(value)
93
+ when 'fontId'
94
+ @font_id = value.value.to_i
95
+ when 'borderId'
96
+ @border_id = value.value.to_i
97
+ when 'fillId'
98
+ @fill_id = value.value.to_i
99
+ when 'numFmtId'
100
+ @number_format_id = value.value.to_i
101
+ when 'quotePrefix'
102
+ @quote_prefix = attribute_enabled?(value)
84
103
  end
85
- cell_style.numerical_format = CellStyle::ALL_FORMAT_VALUE[format_id - 1] if CellStyle::ALL_FORMAT_VALUE[format_id - 1]
86
104
  end
87
- unless current_cell_style.attribute('applyAlignment').nil? || current_cell_style.attribute('applyAlignment').value == '0'
88
- alignment_node = current_cell_style.xpath('xmlns:alignment').first
89
- cell_style.alignment = XlsxAlignment.parse(alignment_node) unless alignment_node.nil?
105
+ style_node.xpath('*').each do |node_child|
106
+ case node_child.name
107
+ when 'alignment'
108
+ @alignment.parse(node_child) if @apply_alignment
109
+ end
90
110
  end
91
- cell_style.quote_prefix = option_enabled?(current_cell_style, 'quotePrefix')
92
- cell_style
111
+ calculate_values
112
+ self
113
+ end
114
+
115
+ def calculate_values
116
+ @font = root_object.style_sheet.fonts[@font_id]
117
+ @borders = Borders.parse_from_style(@border_id) if @apply_border
118
+ @fill_color = root_object.style_sheet.fills[@fill_id] if @apply_fill
119
+ return unless @apply_number_format
120
+ format = root_object.style_sheet.number_formats.format_by_id(@number_format_id)
121
+ @numerical_format = if format
122
+ format.format_code
123
+ else
124
+ CellStyle::ALL_FORMAT_VALUE[@number_format_id - 1]
125
+ end
93
126
  end
94
127
  end
95
128
  end
@@ -7,25 +7,29 @@ module OoxmlParser
7
7
  # @return [String] text without applying any style modificators, like quote_prefix
8
8
  attr_accessor :raw_text
9
9
 
10
- def initialize(style = nil, text = '')
10
+ def initialize(style = nil, text = '', parent: nil)
11
11
  @style = style
12
12
  @text = text
13
13
  @raw_text = ''
14
+ @parent = parent
14
15
  end
15
16
 
16
- def self.parse(cell_node)
17
+ # Parse XlsxCell object
18
+ # @param node [Nokogiri::XML:Element] node to parse
19
+ # @return [XlsxCell] result of parsing
20
+ def parse(node)
17
21
  text_string_id = nil
18
- text_string_id = cell_node.attribute('s').value unless cell_node.attribute('s').nil?
19
- cell = XlsxCell.new(CellStyle.parse(text_string_id))
20
- if cell_node.attribute('t').nil?
21
- cell.raw_text = cell_node.xpath('xmlns:v').text
22
+ text_string_id = node.attribute('s').value unless node.attribute('s').nil?
23
+ @style = CellStyle.new(parent: self).parse(text_string_id)
24
+ if node.attribute('t').nil?
25
+ @raw_text = node.xpath('xmlns:v').text
22
26
  else
23
- cell_node.attribute('t').value == 's' ? get_shared_string(cell_node.xpath('xmlns:v').text, cell) : cell.raw_text = cell_node.xpath('xmlns:v').text
27
+ node.attribute('t').value == 's' ? XlsxCell.get_shared_string(node.xpath('xmlns:v').text, self) : @raw_text = node.xpath('xmlns:v').text
24
28
  end
25
- cell.formula = cell_node.xpath('xmlns:f').text unless cell_node.xpath('xmlns:f').text == ''
26
- cell.text = cell.raw_text.dup unless cell.raw_text.nil?
27
- cell.text.insert(0, "'") if cell.style.quote_prefix
28
- cell
29
+ @formula = node.xpath('xmlns:f').text unless node.xpath('xmlns:f').text == ''
30
+ @text = @raw_text.dup unless @raw_text.nil?
31
+ @text.insert(0, "'") if @style.quote_prefix
32
+ self
29
33
  end
30
34
 
31
35
  # Get shared string by it's number
@@ -37,7 +41,7 @@ module OoxmlParser
37
41
  XLSXWorkbook.shared_strings[value.to_i].xpath('*').each do |si_node_child|
38
42
  case si_node_child.name
39
43
  when 'r'
40
- cell.character = ParagraphRun.parse(si_node_child)
44
+ cell.character = ParagraphRun.new(parent: cell).parse(si_node_child)
41
45
  when 't'
42
46
  cell.raw_text = si_node_child.text
43
47
  end