ooxml_parser 0.32.0 → 0.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +9 -0
  3. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +6 -2
  4. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +15 -9
  5. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +2 -1
  6. 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 +1 -1
  7. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +4 -4
  8. data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +2 -2
  9. data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +14 -13
  10. data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +4 -0
  11. data/lib/ooxml_parser/common_parser/common_data/color.rb +17 -13
  12. data/lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb +19 -5
  13. data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +34 -12
  14. data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +2 -2
  15. data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +4 -0
  16. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +22 -1
  17. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/numbering_properties.rb +18 -4
  18. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +4 -2
  19. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_fonts.rb +26 -0
  20. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +12 -3
  21. data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +4 -4
  22. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +14 -4
  23. data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +3 -2
  24. data/lib/ooxml_parser/common_parser/common_data/underline.rb +22 -1
  25. data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +14 -0
  26. data/lib/ooxml_parser/common_parser/parser/ooxml_file.rb +10 -0
  27. data/lib/ooxml_parser/docx_parser/document_structure/default_style_helper.rb +79 -0
  28. data/lib/ooxml_parser/docx_parser/document_structure/document_background.rb +6 -1
  29. data/lib/ooxml_parser/docx_parser/document_structure/document_style.rb +9 -3
  30. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/accent.rb +9 -2
  31. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb +9 -3
  32. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/group_char.rb +25 -4
  33. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/matrix.rb +2 -1
  34. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +25 -19
  35. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/field_char.rb +22 -0
  36. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run.rb +3 -1
  37. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox/checkbox_state.rb +26 -0
  38. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb +35 -0
  39. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/combobox/list_item.rb +26 -0
  40. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/combobox.rb +28 -0
  41. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/dropdown_list.rb +27 -0
  42. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb +48 -0
  43. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties/form_text_comb.rb +26 -0
  44. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties/form_text_format.rb +30 -0
  45. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb +45 -0
  46. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb +25 -0
  47. data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph.rb +6 -5
  48. data/lib/ooxml_parser/docx_parser/document_structure/header_footer.rb +14 -2
  49. data/lib/ooxml_parser/docx_parser/document_structure/page_properties/columns.rb +2 -2
  50. data/lib/ooxml_parser/docx_parser/document_structure/page_properties/note.rb +10 -11
  51. data/lib/ooxml_parser/docx_parser/document_structure/page_properties/page_properties/header_footer_reference.rb +27 -0
  52. data/lib/ooxml_parser/docx_parser/document_structure/page_properties/page_properties/page_borders.rb +26 -0
  53. data/lib/ooxml_parser/docx_parser/document_structure/page_properties/page_properties.rb +20 -12
  54. data/lib/ooxml_parser/docx_parser/document_structure/styles/document_defaults/paragraph_properties_default.rb +3 -0
  55. data/lib/ooxml_parser/docx_parser/document_structure/styles.rb +6 -0
  56. data/lib/ooxml_parser/docx_parser/document_structure.rb +2 -69
  57. data/lib/ooxml_parser/pptx_parser/presentation/presentation_comments/presentation_comment.rb +1 -1
  58. data/lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame/chart_reference.rb +22 -0
  59. data/lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb +4 -1
  60. data/lib/ooxml_parser/version.rb +1 -1
  61. data/lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/location.rb +6 -6
  62. data/lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/protection.rb +2 -2
  63. data/lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/xf.rb +5 -5
  64. data/lib/ooxml_parser/xlsx_parser/workbook/workbook_properties.rb +1 -1
  65. data/lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view.rb +2 -2
  66. data/lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part.rb +9 -1
  67. data/lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_column_properties.rb +2 -2
  68. data/lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb +4 -4
  69. data/lib/ooxml_parser/xlsx_parser/workbook/worksheet.rb +2 -1
  70. data/lib/ooxml_parser/xlsx_parser/workbook.rb +1 -1
  71. metadata +18 -3
@@ -4,6 +4,6 @@ module OoxmlParser
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
6
  # [String] Version of Gem
7
- STRING = '0.32.0'
7
+ STRING = '0.34.0'
8
8
  end
9
9
  end
@@ -5,11 +5,11 @@ module OoxmlParser
5
5
  class Location < OOXMLDocumentObject
6
6
  # @return [String] ref of location
7
7
  attr_reader :ref
8
- # @return [True, False] first header row
8
+ # @return [Integer] first header row
9
9
  attr_reader :first_header_row
10
- # @return [True, False] first data row
10
+ # @return [Integer] first data row
11
11
  attr_reader :first_data_row
12
- # @return [True, False] first data column
12
+ # @return [Integer] first data column
13
13
  attr_reader :first_data_column
14
14
 
15
15
  # Parse `<location>` tag
@@ -21,11 +21,11 @@ module OoxmlParser
21
21
  when 'ref'
22
22
  @ref = value.value.to_s
23
23
  when 'firstHeaderRow'
24
- @first_header_row = attribute_enabled?(value)
24
+ @first_header_row = value.value.to_i
25
25
  when 'firstDataRow'
26
- @first_data_row = attribute_enabled?(value)
26
+ @first_data_row = value.value.to_i
27
27
  when 'firstDataCol'
28
- @first_data_column = attribute_enabled?(value)
28
+ @first_data_column = value.value.to_i
29
29
  end
30
30
  end
31
31
  self
@@ -21,9 +21,9 @@ module OoxmlParser
21
21
  node.attributes.each do |key, value|
22
22
  case key
23
23
  when 'locked'
24
- @locked = attribute_enabled?(value)
24
+ @locked = boolean_attribute_value(value)
25
25
  when 'hidden'
26
- @hidden = attribute_enabled?(value)
26
+ @hidden = boolean_attribute_value(value)
27
27
  end
28
28
  end
29
29
  self
@@ -93,15 +93,15 @@ module OoxmlParser
93
93
  node.attributes.each do |key, value|
94
94
  case key
95
95
  when 'applyFont'
96
- @apply_font = attribute_enabled?(value)
96
+ @apply_font = boolean_attribute_value(value)
97
97
  when 'applyBorder'
98
- @apply_border = attribute_enabled?(value)
98
+ @apply_border = boolean_attribute_value(value)
99
99
  when 'applyFill'
100
- @apply_fill = attribute_enabled?(value)
100
+ @apply_fill = boolean_attribute_value(value)
101
101
  when 'applyNumberFormat'
102
- @apply_number_format = attribute_enabled?(value)
102
+ @apply_number_format = boolean_attribute_value(value)
103
103
  when 'applyAlignment'
104
- @apply_alignment = attribute_enabled?(value)
104
+ @apply_alignment = boolean_attribute_value(value)
105
105
  when 'fontId'
106
106
  @font_id = value.value.to_i
107
107
  when 'borderId'
@@ -18,7 +18,7 @@ module OoxmlParser
18
18
  node.attributes.each do |key, value|
19
19
  case key
20
20
  when 'date1904'
21
- @date1904 = attribute_enabled?(value)
21
+ @date1904 = boolean_attribute_value(value)
22
22
  end
23
23
  end
24
24
  self
@@ -32,9 +32,9 @@ module OoxmlParser
32
32
  node.attributes.each do |key, value|
33
33
  case key
34
34
  when 'showGridLines'
35
- @show_gridlines = attribute_enabled?(value)
35
+ @show_gridlines = boolean_attribute_value(value)
36
36
  when 'showRowColHeaders'
37
- @show_row_column_headers = attribute_enabled?(value)
37
+ @show_row_column_headers = boolean_attribute_value(value)
38
38
  when 'topLeftCell'
39
39
  @top_left_cell = Coordinates.new.parse_string(value.value)
40
40
  when 'workbookViewId'
@@ -7,6 +7,8 @@ require_relative 'table_part/table_columns'
7
7
  module OoxmlParser
8
8
  # Class for `tablePart` data
9
9
  class TablePart < OOXMLDocumentObject
10
+ # @return [String] id of table part
11
+ attr_reader :id
10
12
  attr_accessor :name, :display_name, :reference, :autofilter, :columns
11
13
  # @return [ExtensionList] list of extensions
12
14
  attr_accessor :extension_list
@@ -19,7 +21,13 @@ module OoxmlParser
19
21
  # @param node [Nokogiri::XML:Element] node to parse
20
22
  # @return [TablePart] result of parsing
21
23
  def parse(node)
22
- link_to_table_part_xml = root_object.get_link_from_rels(node.attribute('id').value)
24
+ node.attributes.each do |key, value|
25
+ case key
26
+ when 'id'
27
+ @id = value.value.to_s
28
+ end
29
+ end
30
+ link_to_table_part_xml = root_object.get_link_from_rels(@id)
23
31
  doc = parse_xml(root_object.unpacked_folder + link_to_table_part_xml.gsub('..', 'xl'))
24
32
  table_node = doc.xpath('xmlns:table').first
25
33
  table_node.attributes.each do |key, value|
@@ -39,9 +39,9 @@ module OoxmlParser
39
39
  when 'customWidth'
40
40
  @custom_width = option_enabled?(node, 'customWidth')
41
41
  when 'bestFit'
42
- @best_fit = attribute_enabled?(value)
42
+ @best_fit = boolean_attribute_value(value)
43
43
  when 'hidden'
44
- @hidden = attribute_enabled?(value)
44
+ @hidden = boolean_attribute_value(value)
45
45
  end
46
46
  end
47
47
  self
@@ -32,13 +32,13 @@ module OoxmlParser
32
32
  node.attributes.each do |key, value|
33
33
  case key
34
34
  when 'alignWithMargins'
35
- @align_with_margins = attribute_enabled?(value)
35
+ @align_with_margins = boolean_attribute_value(value)
36
36
  when 'differentFirst'
37
- @different_first = attribute_enabled?(value)
37
+ @different_first = boolean_attribute_value(value)
38
38
  when 'differentOddEven'
39
- @different_odd_even = attribute_enabled?(value)
39
+ @different_odd_even = boolean_attribute_value(value)
40
40
  when 'scaleWithDoc'
41
- @scale_with_document = attribute_enabled?(value)
41
+ @scale_with_document = boolean_attribute_value(value)
42
42
  end
43
43
 
44
44
  node.xpath('*').each do |node_child|
@@ -107,7 +107,8 @@ module OoxmlParser
107
107
  @merge << merge_node.attribute('ref').value.to_s
108
108
  end
109
109
  when 'drawing'
110
- path_to_drawing = root_object.get_link_from_rels(worksheet_node_child.attribute('id').value)
110
+ @drawing = DocxDrawing.new(parent: self).parse(worksheet_node_child)
111
+ path_to_drawing = root_object.get_link_from_rels(@drawing.id)
111
112
  unless path_to_drawing.nil?
112
113
  root_object.add_to_xmls_stack(path_to_drawing)
113
114
  parse_drawing
@@ -129,7 +129,7 @@ module OoxmlParser
129
129
  @style_sheet = StyleSheet.new(parent: self).parse
130
130
  @doc.xpath('xmlns:workbook/xmlns:sheets/xmlns:sheet').each do |sheet|
131
131
  @sheets << Sheet.new(parent: self).parse(sheet)
132
- file = @relationships.target_by_id(sheet.attribute('id').value)
132
+ file = @relationships.target_by_id(@sheets.last.id)
133
133
  if file.start_with?('worksheets')
134
134
  @worksheets << Worksheet.new(parent: self).parse(file)
135
135
  @worksheets.last.name = @sheets.last.name
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ooxml_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.0
4
+ version: 0.34.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ONLYOFFICE
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-10-03 00:00:00.000000000 Z
13
+ date: 2022-11-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
@@ -325,6 +325,7 @@ files:
325
325
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb
326
326
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb
327
327
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb
328
+ - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_fonts.rb
328
329
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb
329
330
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb
330
331
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb
@@ -372,6 +373,7 @@ files:
372
373
  - lib/ooxml_parser/docx_parser/document_structure/comments/comment.rb
373
374
  - lib/ooxml_parser/docx_parser/document_structure/comments_extended.rb
374
375
  - lib/ooxml_parser/docx_parser/document_structure/comments_extended/comment_extended.rb
376
+ - lib/ooxml_parser/docx_parser/document_structure/default_style_helper.rb
375
377
  - lib/ooxml_parser/docx_parser/document_structure/document_background.rb
376
378
  - lib/ooxml_parser/docx_parser/document_structure/document_properties.rb
377
379
  - lib/ooxml_parser/docx_parser/document_structure/document_settings.rb
@@ -408,6 +410,7 @@ files:
408
410
  - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_helper.rb
409
411
  - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run.rb
410
412
  - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb
413
+ - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/field_char.rb
411
414
  - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
412
415
  - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/object.rb
413
416
  - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb
@@ -424,6 +427,15 @@ files:
424
427
  - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/inserted.rb
425
428
  - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_content.rb
426
429
  - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb
430
+ - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
431
+ - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox/checkbox_state.rb
432
+ - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/combobox.rb
433
+ - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/combobox/list_item.rb
434
+ - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/dropdown_list.rb
435
+ - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb
436
+ - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb
437
+ - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties/form_text_comb.rb
438
+ - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties/form_text_format.rb
427
439
  - lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/structured_document_tag.rb
428
440
  - lib/ooxml_parser/docx_parser/document_structure/header_footer.rb
429
441
  - lib/ooxml_parser/docx_parser/document_structure/numbering.rb
@@ -442,6 +454,8 @@ files:
442
454
  - lib/ooxml_parser/docx_parser/document_structure/page_properties/note.rb
443
455
  - lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb
444
456
  - lib/ooxml_parser/docx_parser/document_structure/page_properties/page_properties.rb
457
+ - lib/ooxml_parser/docx_parser/document_structure/page_properties/page_properties/header_footer_reference.rb
458
+ - lib/ooxml_parser/docx_parser/document_structure/page_properties/page_properties/page_borders.rb
445
459
  - lib/ooxml_parser/docx_parser/document_structure/page_properties/page_size.rb
446
460
  - lib/ooxml_parser/docx_parser/document_structure/styles.rb
447
461
  - lib/ooxml_parser/docx_parser/document_structure/styles/document_defaults.rb
@@ -469,6 +483,7 @@ files:
469
483
  - lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
470
484
  - lib/ooxml_parser/pptx_parser/presentation/slide/connection_shape.rb
471
485
  - lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb
486
+ - lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame/chart_reference.rb
472
487
  - lib/ooxml_parser/pptx_parser/presentation/slide/presentation_alternate_content.rb
473
488
  - lib/ooxml_parser/pptx_parser/presentation/slide/presentation_notes.rb
474
489
  - lib/ooxml_parser/pptx_parser/presentation/slide/slide/shapes_grouping.rb
@@ -610,7 +625,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
610
625
  - !ruby/object:Gem::Version
611
626
  version: '0'
612
627
  requirements: []
613
- rubygems_version: 3.3.22
628
+ rubygems_version: 3.3.25
614
629
  signing_key:
615
630
  specification_version: 4
616
631
  summary: OoxmlParser Gem