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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f40b6ee146d2fa4c06246636b63931ec3c178a2c
4
- data.tar.gz: 08e151b4a17546c6787000bac1d727687ff6f5b5
3
+ metadata.gz: 17ff610450bb961ad457f38aa206097940893f58
4
+ data.tar.gz: bcfe11a7a961f9a103eb8c047fb503e324d05bb3
5
5
  SHA512:
6
- metadata.gz: 15187c6a9a8ac851637a1d9bfaa1f69cb651f6d22533fa66cb3b1c97c6960494daa6e3a82a2c38fec149c9c7d117289dc946273ee5b2626927b60627986f9b67
7
- data.tar.gz: a1bfd37779ec4e6003a71e90f5eaed425eeca04bfb7d849e523f21b567413ad958fb227acb55cf7a15d3d97590e391a590953207451b880751e7b0d4b70fb075
6
+ metadata.gz: 03f3590091b03d708883a052300a754e9e94b64c55fbc85564514d3194d8bf3e9e1927069eaa30ee2aea0a095e77a089c0a899029eceb5f60394064869e6c59c
7
+ data.tar.gz: 4c7eb4fa0cf09ced780de674a48acd4939b29b01bb09b0e240627cc1654a1f90a945c738dba76d0e59db3c88ee859028f3dda38b4990c8165bc9adf9b200ef67
data/README.md CHANGED
@@ -11,16 +11,17 @@ _ooxml_parser_ is a Ooxml files (docx, xlsx, pptx) parser written in Ruby.
11
11
  Parse a docx file
12
12
 
13
13
  require 'ooxml_parser'
14
- docx = OoxmlParser::DocxParser.parse_docx('spec/docx_examples/document_properties/page_count.docx')
14
+ docx = OoxmlParser::Parser.parse('spec/document/document_properties/page_count.docx')
15
15
  p docx.document_properties.pages # 2
16
16
 
17
17
 
18
18
  ## Configuration
19
19
 
20
- Set units of mesaurements:
21
- Possible units are `:points`, `:centimeters`, `:dxa`, `:inches`, `:emu`
22
- Default is `:centimeters`
20
+ ### Accuracy
21
+
22
+ Accuracy of digits in fraction part
23
+ Default is 2 digits in fraction part
23
24
 
24
25
  OoxmlParser.configure do |config|
25
- config.units = :points
26
+ config.accuracy = 3
26
27
  end
@@ -0,0 +1,19 @@
1
+ module OoxmlParser
2
+ # Chart Style
3
+ class ChartStyle < OOXMLDocumentObject
4
+ attr_accessor :style_number
5
+
6
+ # Parse ChartStyle
7
+ # @param [Nokogiri::XML:Node] node with Relationships
8
+ # @return [ChartStyle] result of parsing
9
+ def parse(node)
10
+ node.xpath('*').each do |node_child|
11
+ case node_child.name
12
+ when 'style'
13
+ @style_number = node_child.attribute('val').value.to_i
14
+ end
15
+ end
16
+ self
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ module OoxmlParser
2
+ # Class for storing math paragraph
3
+ class MathParagraph < OOXMLDocumentObject
4
+ attr_accessor :math
5
+ # Parse MathParagraph object
6
+ # @param node [Nokogiri::XML:Element] node to parse
7
+ # @return [MathParagraph] result of parsing
8
+ def parse(node)
9
+ node.xpath('*').each do |node_child|
10
+ case node_child.name
11
+ when 'oMath'
12
+ @math = DocxFormula.new(parent: self).parse(node_child)
13
+ end
14
+ end
15
+ self
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ require_relative 'math_text/math_paragraph'
2
+ module OoxmlParser
3
+ # Class for storing math text
4
+ class MathText < OOXMLDocumentObject
5
+ attr_accessor :math_paragraph
6
+ # Parse MathText object
7
+ # @param node [Nokogiri::XML:Element] node to parse
8
+ # @return [MathText] result of parsing
9
+ def parse(node)
10
+ node.xpath('*').each do |node_child|
11
+ case node_child.name
12
+ when 'oMathPara'
13
+ @math_paragraph = MathParagraph.new(parent: self).parse(node_child)
14
+ end
15
+ end
16
+ self
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'choice/math_text'
2
+ module OoxmlParser
3
+ # Class for storing choice (for office 2014 and newer)
4
+ # graphic data
5
+ class Choice < OOXMLDocumentObject
6
+ attr_accessor :math_text
7
+ # Parse Choice object
8
+ # @param node [Nokogiri::XML:Element] node to parse
9
+ # @return [Choice] result of parsing
10
+ def parse(node)
11
+ node.xpath('*').each do |node_child|
12
+ case node_child.name
13
+ when 'm'
14
+ @math_text = MathText.new(parent: self).parse(node_child)
15
+ end
16
+ end
17
+ self
18
+ end
19
+ end
20
+ end
@@ -1,34 +1,40 @@
1
+ require_relative 'alternate_content/choice'
2
+ require_relative 'alternate_content/chart_style'
1
3
  require_relative 'chart/chart'
2
4
  require_relative 'drawing/docx_drawing'
3
- require_relative 'shape/shape'
4
5
  require_relative 'picture/old_docx_picture'
5
- # Class for storing fallback graphic elements
6
6
  module OoxmlParser
7
- class AlternateContent
7
+ # Class for storing fallback graphic elements
8
+ class AlternateContent < OOXMLDocumentObject
8
9
  attr_accessor :office2010_content, :office2007_content
10
+ # @return [Choice] choice data
11
+ attr_accessor :choice
9
12
 
10
- def self.parse(alt_content_node)
11
- alternate_content = AlternateContent.new
12
- alt_content_node.xpath('*').each do |alternate_content_node_child|
13
+ # Parse AlternateContent
14
+ # @param [Nokogiri::XML:Node] node with Relationships
15
+ # @return [AlternateContent] result of parsing
16
+ def parse(node)
17
+ node.xpath('*').each do |node_child|
13
18
  begin
14
- alternate_content_node_child.xpath('w:drawing')
19
+ node_child.xpath('w:drawing')
15
20
  rescue Nokogiri::XML::XPath::SyntaxError # This mean it is Chart
16
- case alternate_content_node_child.name
21
+ case node_child.name
17
22
  when 'Choice'
18
- alternate_content.office2010_content = Office2010ChartStyle.parse(alternate_content_node_child)
23
+ @office2010_content = ChartStyle.new(parent: self).parse(node_child)
19
24
  when 'Fallback'
20
- alternate_content.office2007_content = Office2007ChartStyle.parse(alternate_content_node_child)
25
+ @office2007_content = ChartStyle.new(parent: self).parse(node_child)
21
26
  end
22
27
  next
23
28
  end
24
- case alternate_content_node_child.name
29
+ case node_child.name
25
30
  when 'Choice'
26
- alternate_content.office2010_content = DocxDrawing.parse(alternate_content_node_child.xpath('w:drawing').first) unless alternate_content_node_child.xpath('w:drawing').first.nil?
31
+ @office2010_content = DocxDrawing.new(parent: self).parse(node_child.xpath('w:drawing').first) unless node_child.xpath('w:drawing').first.nil?
32
+ @choice = Choice.new(parent: self).parse(node_child)
27
33
  when 'Fallback'
28
- alternate_content.office2007_content = OldDocxPicture.parse(alternate_content_node_child.xpath('w:pict').first) unless alternate_content_node_child.xpath('w:pict').first.nil?
34
+ @office2007_content = OldDocxPicture.new(parent: self).parse(node_child.xpath('w:pict').first) unless node_child.xpath('w:pict').first.nil?
29
35
  end
30
36
  end
31
- alternate_content
37
+ self
32
38
  end
33
39
  end
34
40
  end
@@ -0,0 +1,20 @@
1
+ module OoxmlParser
2
+ # Class for parsing `c:order` object
3
+ class Order < OOXMLDocumentObject
4
+ # @return [Integer] value of order
5
+ attr_accessor :value
6
+
7
+ # Parse Order
8
+ # @param [Nokogiri::XML:Node] node with Order
9
+ # @return [Order] result of parsing
10
+ def parse(node)
11
+ node.attributes.each do |key, value|
12
+ case key
13
+ when 'val'
14
+ @value = value.value.to_f
15
+ end
16
+ end
17
+ self
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module OoxmlParser
2
+ # Class for parsing `c:idx` object
3
+ class SeriesIndex < OOXMLDocumentObject
4
+ # @return [Integer] value of index
5
+ attr_accessor :value
6
+
7
+ # Parse SeriesIndex
8
+ # @param [Nokogiri::XML:Node] node with Index
9
+ # @return [SeriesIndex] result of parsing
10
+ def parse(node)
11
+ node.attributes.each do |key, value|
12
+ case key
13
+ when 'val'
14
+ @value = value.value.to_f
15
+ end
16
+ end
17
+ self
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ module OoxmlParser
2
+ # Class for parsing `c:v` object
3
+ class TextValue < OOXMLDocumentObject
4
+ # @return [String] text of value
5
+ attr_accessor :value
6
+
7
+ # Parse TextValue
8
+ # @param [Nokogiri::XML:Node] node with TextValue
9
+ # @return [TextValue] result of parsing
10
+ def parse(node)
11
+ @value = node.text
12
+ self
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,31 @@
1
+ require_relative 'point/text_value'
2
+ module OoxmlParser
3
+ # Class for parsing `c:pt` object
4
+ class Point < OOXMLDocumentObject
5
+ # @return [Integer] index of point
6
+ attr_accessor :index
7
+ # @return [TextValue] value of text
8
+ attr_accessor :text
9
+
10
+ # Parse PointCount
11
+ # @param [Nokogiri::XML:Node] node with PointCount
12
+ # @return [PointCount] result of parsing
13
+ def parse(node)
14
+ node.attributes.each do |key, value|
15
+ case key
16
+ when 'idx'
17
+ @index = value.value.to_f
18
+ end
19
+ end
20
+
21
+ node.xpath('*').each do |node_child|
22
+ case node_child.name
23
+ when 'v'
24
+ @text = TextValue.new(parent: self).parse(node_child)
25
+ end
26
+ end
27
+
28
+ self
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,20 @@
1
+ module OoxmlParser
2
+ # Class for parsing `c:ptCount` object
3
+ class PointCount < OOXMLDocumentObject
4
+ # @return [Integer] value of point count
5
+ attr_accessor :value
6
+
7
+ # Parse PointCount
8
+ # @param [Nokogiri::XML:Node] node with PointCount
9
+ # @return [PointCount] result of parsing
10
+ def parse(node)
11
+ node.attributes.each do |key, value|
12
+ case key
13
+ when 'val'
14
+ @value = value.value.to_f
15
+ end
16
+ end
17
+ self
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,31 @@
1
+ require_relative 'string_cache/point_count'
2
+ require_relative 'string_cache/point'
3
+ module OoxmlParser
4
+ # Class for parsing `c:tx` object
5
+ class StringCache < OOXMLDocumentObject
6
+ # @return [StringReference] String reference of series
7
+ attr_accessor :point_count
8
+ # @return [Array, Point] array of points
9
+ attr_accessor :points
10
+
11
+ def initialize(parent: nil)
12
+ @points = []
13
+ @parent = parent
14
+ end
15
+
16
+ # Parse Order
17
+ # @param [Nokogiri::XML:Node] node with Order
18
+ # @return [Order] result of parsing
19
+ def parse(node)
20
+ node.xpath('*').each do |node_child|
21
+ case node_child.name
22
+ when 'ptCount'
23
+ @point_count = PointCount.new(parent: self).parse(node_child)
24
+ when 'pt'
25
+ @points << Point.new(parent: self).parse(node_child)
26
+ end
27
+ end
28
+ self
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,25 @@
1
+ require_relative 'string_reference/string_cache'
2
+ module OoxmlParser
3
+ # Class for parsing `c:strRef` object
4
+ class StringReference < OOXMLDocumentObject
5
+ # @return [String] formula
6
+ attr_accessor :formula
7
+ # @return [StringCache] cache of string
8
+ attr_accessor :cache
9
+
10
+ # Parse Order
11
+ # @param [Nokogiri::XML:Node] node with Order
12
+ # @return [Order] result of parsing
13
+ def parse(node)
14
+ node.xpath('*').each do |reference_child|
15
+ case reference_child.name
16
+ when 'f'
17
+ @formula = reference_child.text
18
+ when 'strCache'
19
+ @cache = StringCache.new(parent: self).parse(reference_child)
20
+ end
21
+ end
22
+ self
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ require_relative 'series_text/string_reference'
2
+ module OoxmlParser
3
+ # Class for parsing `c:tx` object
4
+ class SeriesText < OOXMLDocumentObject
5
+ # @return [StringReference] String reference of series
6
+ attr_accessor :string
7
+
8
+ # Parse Order
9
+ # @param [Nokogiri::XML:Node] node with Order
10
+ # @return [Order] result of parsing
11
+ def parse(node)
12
+ node.xpath('*').each do |series_child|
13
+ case series_child.name
14
+ when 'strRef'
15
+ @string = StringReference.new(parent: self).parse(series_child)
16
+ end
17
+ end
18
+ self
19
+ end
20
+ end
21
+
22
+ Categories = SeriesText
23
+ end
@@ -0,0 +1,39 @@
1
+ require_relative 'series/order'
2
+ require_relative 'series/series_index'
3
+ require_relative 'series/series_text'
4
+ module OoxmlParser
5
+ # Class for parsing `c:ser` object
6
+ class Series < OOXMLDocumentObject
7
+ # @return [Index] index of chart
8
+ attr_accessor :index
9
+ # @return [Order] order of chart
10
+ attr_accessor :order
11
+ # @return [SeriesText] text of series
12
+ attr_accessor :text
13
+ # @return [Categories] categories of chart
14
+ attr_accessor :categories
15
+ # @return [DisplayLabelsProperties]
16
+ attr_accessor :display_labels
17
+
18
+ # Parse Series
19
+ # @param [Nokogiri::XML:Node] node with Series
20
+ # @return [Series] result of parsing
21
+ def parse(node)
22
+ node.xpath('*').each do |node_child|
23
+ case node_child.name
24
+ when 'idx'
25
+ @index = SeriesIndex.new(parent: self).parse(node_child)
26
+ when 'order'
27
+ @order = Order.new(parent: self).parse(node_child)
28
+ when 'tx'
29
+ @text = SeriesText.new(parent: self).parse(node_child)
30
+ when 'cat'
31
+ @categories = Categories.new(parent: self).parse(node_child)
32
+ when 'dLbls'
33
+ @display_labels = DisplayLabelsProperties.new(parent: self).parse(node_child)
34
+ end
35
+ end
36
+ self
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,32 @@
1
+ module OoxmlParser
2
+ # Parsing Chart 3D view tag 'view3D'
3
+ class View3D < OOXMLDocumentObject
4
+ # @return [ValuedChild] This element specifies the amount
5
+ # a 3-D chart shall be rotated in the X direction
6
+ attr_accessor :rotation_x
7
+ # @return [ValuedChild] This element specifies the amount
8
+ # a 3-D chart shall be rotated in the Y direction
9
+ attr_accessor :rotation_y
10
+ # @return [True, False] This element specifies that the
11
+ # chart axes are at right angles, rather than drawn
12
+ # in perspective. Applies only to 3-D charts.
13
+ attr_accessor :right_angle_axis
14
+
15
+ # Parse View3D object
16
+ # @param node [Nokogiri::XML:Element] node to parse
17
+ # @return [View3D] result of parsing
18
+ def parse(node)
19
+ node.xpath('*').each do |node_child|
20
+ case node_child.name
21
+ when 'rotX'
22
+ @rotation_x = ValuedChild.new(:integer, parent: self).parse(node_child)
23
+ when 'rotY'
24
+ @rotation_y = ValuedChild.new(:integer, parent: self).parse(node_child)
25
+ when 'rAngAx'
26
+ @right_angle_axis = option_enabled?(node_child)
27
+ end
28
+ end
29
+ self
30
+ end
31
+ end
32
+ end
@@ -3,12 +3,16 @@ require_relative 'chart_cells_range'
3
3
  require_relative 'chart_legend'
4
4
  require_relative 'chart_point'
5
5
  require_relative 'display_labels_properties'
6
- require_relative 'chart_style/office_2007_chart_style'
7
- require_relative 'chart_style/office_2010_chart_style'
6
+ require_relative 'chart/series'
7
+ require_relative 'chart/view_3d'
8
8
 
9
9
  module OoxmlParser
10
10
  class Chart < OOXMLDocumentObject
11
11
  attr_accessor :type, :data, :grouping, :title, :legend, :display_labels, :axises, :alternate_content, :shape_properties
12
+ # @return [Array, Series] series of chart
13
+ attr_accessor :series
14
+ # @return [View3D] properties of 3D view
15
+ attr_accessor :view_3d
12
16
 
13
17
  def initialize
14
18
  @type = ''
@@ -17,6 +21,7 @@ module OoxmlParser
17
21
  @title = nil
18
22
  @legend = nil
19
23
  @axises = []
24
+ @series = []
20
25
  end
21
26
 
22
27
  def parse_properties(chart_prop_node)
@@ -25,18 +30,17 @@ module OoxmlParser
25
30
  when 'grouping'
26
31
  @grouping = chart_props_node_child.attribute('val').value.to_sym
27
32
  when 'ser'
33
+ @series << Series.new(parent: self).parse(chart_props_node_child)
28
34
  case @type
29
- when :bar, :line, :area, :pie, :doughnut, :radar, :stock, :surface_3d, :column
30
- val = chart_props_node_child.xpath('c:val')[0]
31
35
  when :point, :bubble
32
36
  val = chart_props_node_child.xpath('c:yVal')[0]
33
37
  else
34
- next
38
+ val = chart_props_node_child.xpath('c:val')[0]
35
39
  end
36
40
  next if val.xpath('c:numRef').empty?
37
- @data << ChartCellsRange.parse(val.xpath('c:numRef').first).dup
41
+ @data << ChartCellsRange.new(parent: self).parse(val.xpath('c:numRef').first).dup
38
42
  when 'dLbls'
39
- @display_labels = DisplayLabelsProperties.parse(chart_props_node_child)
43
+ @display_labels = DisplayLabelsProperties.new(parent: self).parse(chart_props_node_child)
40
44
  end
41
45
  end
42
46
  end
@@ -44,76 +48,79 @@ module OoxmlParser
44
48
  def self.parse
45
49
  chart = Chart.new
46
50
  chart_xml = Nokogiri::XML(File.open(OOXMLDocumentObject.current_xml))
47
- chart_xml.xpath('c:chartSpace/*', 'xmlns:c' => 'http://schemas.openxmlformats.org/drawingml/2006/chart').each do |chart_space_node_child|
48
- case chart_space_node_child.name
49
- when 'AlternateContent'
50
- chart.alternate_content = AlternateContent.parse(chart_space_node_child)
51
- when 'spPr'
52
- chart.shape_properties = DocxShapeProperties.parse chart_space_node_child
53
- when 'chart'
54
- chart_space_node_child.xpath('*').each do |chart_node_child|
55
- case chart_node_child.name
56
- when 'plotArea'
57
- chart_node_child.xpath('*').each do |plot_area_node_child|
58
- next unless chart.type.empty?
59
- case plot_area_node_child.name
60
- when 'barChart'
61
- chart.type = :bar
62
- bar_dir_node = plot_area_node_child.xpath('c:barDir')
63
- unless bar_dir_node.first.nil?
64
- chart.type = :column if bar_dir_node.first.attribute('val').value == 'col'
51
+ chart_xml.xpath('*').each do |chart_node|
52
+ case chart_node.name
53
+ when 'chartSpace'
54
+ chart_node.xpath('*').each do |chart_space_node_child|
55
+ case chart_space_node_child.name
56
+ when 'AlternateContent'
57
+ chart.alternate_content = AlternateContent.new(parent: chart).parse(chart_space_node_child)
58
+ when 'spPr'
59
+ chart.shape_properties = DocxShapeProperties.new(parent: chart).parse(chart_space_node_child)
60
+ when 'chart'
61
+ chart_space_node_child.xpath('*').each do |chart_node_child|
62
+ case chart_node_child.name
63
+ when 'plotArea'
64
+ chart_node_child.xpath('*').each do |plot_area_node_child|
65
+ next unless chart.type.empty?
66
+ case plot_area_node_child.name
67
+ when 'barChart'
68
+ chart.type = :bar
69
+ bar_dir_node = plot_area_node_child.xpath('c:barDir')
70
+ chart.type = :column if bar_dir_node.first.attribute('val').value == 'col'
71
+ chart.parse_properties(plot_area_node_child)
72
+ when 'lineChart'
73
+ chart.type = :line
74
+ chart.parse_properties(plot_area_node_child)
75
+ when 'areaChart'
76
+ chart.type = :area
77
+ chart.parse_properties(plot_area_node_child)
78
+ when 'bubbleChart'
79
+ chart.type = :bubble
80
+ chart.parse_properties(plot_area_node_child)
81
+ when 'doughnutChart'
82
+ chart.type = :doughnut
83
+ chart.parse_properties(plot_area_node_child)
84
+ when 'pieChart'
85
+ chart.type = :pie
86
+ chart.parse_properties(plot_area_node_child)
87
+ when 'scatterChart'
88
+ chart.type = :point
89
+ chart.parse_properties(plot_area_node_child)
90
+ when 'radarChart'
91
+ chart.type = :radar
92
+ chart.parse_properties(plot_area_node_child)
93
+ when 'stockChart'
94
+ chart.type = :stock
95
+ chart.parse_properties(plot_area_node_child)
96
+ when 'surface3DChart'
97
+ chart.type = :surface_3d
98
+ chart.parse_properties(plot_area_node_child)
99
+ when 'line3DChart'
100
+ chart.type = :line_3d
101
+ chart.parse_properties(plot_area_node_child)
102
+ when 'bar3DChart'
103
+ chart.type = :bar_3d
104
+ chart.parse_properties(plot_area_node_child)
105
+ when 'pie3DChart'
106
+ chart.type = :pie_3d
107
+ chart.parse_properties(plot_area_node_child)
108
+ end
65
109
  end
66
- chart.parse_properties(plot_area_node_child)
67
- when 'lineChart'
68
- chart.type = :line
69
- chart.parse_properties(plot_area_node_child)
70
- when 'areaChart'
71
- chart.type = :area
72
- chart.parse_properties(plot_area_node_child)
73
- when 'bubbleChart'
74
- chart.type = :bubble
75
- chart.parse_properties(plot_area_node_child)
76
- when 'doughnutChart'
77
- chart.type = :doughnut
78
- chart.parse_properties(plot_area_node_child)
79
- when 'pieChart'
80
- chart.type = :pie
81
- chart.parse_properties(plot_area_node_child)
82
- when 'scatterChart'
83
- chart.type = :point
84
- chart.parse_properties(plot_area_node_child)
85
- when 'radarChart'
86
- chart.type = :radar
87
- chart.parse_properties(plot_area_node_child)
88
- when 'stockChart'
89
- chart.type = :stock
90
- chart.parse_properties(plot_area_node_child)
91
- when 'surface3DChart'
92
- chart.type = :surface_3d
93
- chart.parse_properties(plot_area_node_child)
94
- when 'line3DChart'
95
- chart.type = :line_3d
96
- chart.parse_properties(plot_area_node_child)
97
- when 'bar3DChart'
98
- chart.type = :bar_3d
99
- chart.parse_properties(plot_area_node_child)
100
- when 'pie3DChart'
101
- chart.type = :pie_3d
102
- chart.parse_properties(plot_area_node_child)
103
- end
104
- end
105
- chart_node_child.xpath('*').each do |plot_area_node_child|
106
- case plot_area_node_child.name
107
- when 'catAx'
108
- chart.axises << ChartAxis.parse(plot_area_node_child)
109
- when 'valAx'
110
- chart.axises << ChartAxis.parse(plot_area_node_child)
110
+ chart_node_child.xpath('*').each do |plot_area_node_child|
111
+ case plot_area_node_child.name
112
+ when 'catAx', 'valAx'
113
+ chart.axises << ChartAxis.new(parent: chart).parse(plot_area_node_child)
114
+ end
115
+ end
116
+ when 'title'
117
+ chart.title = ChartAxisTitle.new(parent: chart).parse(chart_node_child)
118
+ when 'legend'
119
+ chart.legend = ChartLegend.new(parent: chart).parse(chart_node_child)
120
+ when 'view3D'
121
+ chart.view_3d = View3D.new(parent: chart).parse(chart_node_child)
111
122
  end
112
123
  end
113
- when 'title'
114
- chart.title = ChartAxisTitle.parse(chart_node_child)
115
- when 'legend'
116
- chart.legend = ChartLegend.parse(chart_node_child)
117
124
  end
118
125
  end
119
126
  end