ooxml_parser 0.31.0 → 0.32.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 682b6146d274c90e967ce9d494c4c6df0fafe597d9dc01fc27c3b8fa854630c2
4
- data.tar.gz: a5f7c131398910ef896a0c0b21578083e02dbe84aa6d024bf4abd4e2fab2c1bb
3
+ metadata.gz: 7cf7caeb2bfc8c48e6727c5a35c8514e07cf85fe2f528e742dd96be9473b3318
4
+ data.tar.gz: 07e1d21315c8dcd83664019f93cc1992926e176024420bd9fcdbc4de0837f9dd
5
5
  SHA512:
6
- metadata.gz: df07e615fd1ecc0c4436072b978f6f6ba8959a83785d88fe2a1922417c94daef2227ae4914f34683e3f9542ca35e68de2652c5cf78b2a52cf828d6f46b850aa2
7
- data.tar.gz: 0fce9c7ca3617ef27c67acc338f8e2eaa7a2220d98de3d4367d4b4bcf89f445a1982e58fe2e3f4ec6aa1bca48e8ed533f7bed9ad0a7d64244620f47dd241b4c3
6
+ metadata.gz: 743b318ed40ff1805d7c6db6f32532dca25c6452be286808fcd52e5992e41bfa0a36de2574fcc828984f4dee095a75ba80cfc2221c49ef923db1880092ff9d83
7
+ data.tar.gz: 781db58bd859d241763049196327cfed403d3eb2fbb5288e9018a05eabab1f69b4115783e43166817e08e8e13485c25d1ada81db0cede73b82af38d52c4ca493
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OoxmlParser
4
+ # Class for parsing <buBlip> tag
5
+ class BulletImage < OOXMLDocumentObject
6
+ # @return [FileReference] image structure
7
+ attr_reader :file_reference
8
+
9
+ # Parse BulletImage object
10
+ # @param node [Nokogiri::XML:Element] node to parse
11
+ # @return [BulletImage] result of parsing
12
+ def parse(node)
13
+ node.xpath('*').each do |node_child|
14
+ case node_child.name
15
+ when 'blip'
16
+ @file_reference = FileReference.new(parent: self).parse(node_child)
17
+ end
18
+ end
19
+ self
20
+ end
21
+ end
22
+ end
@@ -3,7 +3,7 @@
3
3
  module OoxmlParser
4
4
  # Class for parsing `numPr` tags
5
5
  class NumberingProperties < OOXMLDocumentObject
6
- attr_accessor :size, :font, :symbol, :start_at, :type, :ilvl, :numbering_properties
6
+ attr_accessor :size, :font, :symbol, :start_at, :type, :image, :ilvl, :numbering_properties
7
7
 
8
8
  def initialize(ilvl = 0, parent: nil)
9
9
  @ilvl = ilvl
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'paragrpah_properties/numbering_properties'
4
- require_relative 'paragrpah_properties/paragraph_borders'
5
- require_relative 'paragrpah_properties/paragraph_spacing'
6
- require_relative 'paragrpah_properties/paragraph_stlye_ref'
7
- require_relative 'paragrpah_properties/spacing'
8
- require_relative 'paragrpah_properties/tabs'
3
+ require_relative 'paragraph_properties/numbering_properties'
4
+ require_relative 'paragraph_properties/paragraph_borders'
5
+ require_relative 'paragraph_properties/paragraph_spacing'
6
+ require_relative 'paragraph_properties/paragraph_style_ref'
7
+ require_relative 'paragraph_properties/spacing'
8
+ require_relative 'paragraph_properties/tabs'
9
+ require_relative 'paragraph_properties/bullet_image'
9
10
  module OoxmlParser
10
11
  # Class for data for ParagraphProperties
11
12
  class ParagraphProperties < OOXMLDocumentObject
@@ -74,6 +75,8 @@ module OoxmlParser
74
75
  @numbering.font = node_child.attribute('typeface').value
75
76
  when 'buChar'
76
77
  @numbering.symbol = node_child.attribute('char').value
78
+ when 'buBlip'
79
+ @numbering.image = BulletImage.new(parent: self).parse(node_child)
77
80
  when 'buAutoNum'
78
81
  @numbering.type = node_child.attribute('type').value.to_sym
79
82
  @numbering.start_at = node_child.attribute('startAt').value if node_child.attribute('startAt')
@@ -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.31.0'
7
+ STRING = '0.32.0'
8
8
  end
9
9
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OoxmlParser
4
+ # Class for parsing <workbookPr> tag
5
+ class WorkbookProperties < OOXMLDocumentObject
6
+ # @return [True, False] Specifies if 1904 date system is used in workbook
7
+ attr_reader :date1904
8
+
9
+ def initialize(parent: nil)
10
+ @date1904 = false
11
+ super
12
+ end
13
+
14
+ # Parse WorkbookProperties data
15
+ # @param [Nokogiri::XML:Element] node with WorkbookProperties data
16
+ # @return [WorkbookProperties] value of WorkbookProperties
17
+ def parse(node)
18
+ node.attributes.each do |key, value|
19
+ case key
20
+ when 'date1904'
21
+ @date1904 = attribute_enabled?(value)
22
+ end
23
+ end
24
+ self
25
+ end
26
+ end
27
+ end
@@ -4,6 +4,7 @@ require_relative 'workbook/chartsheet'
4
4
  require_relative 'workbook/pivot_cache'
5
5
  require_relative 'workbook/pivot_table_definition'
6
6
  require_relative 'workbook/defined_name'
7
+ require_relative 'workbook/workbook_properties'
7
8
  require_relative 'workbook/workbook_protection'
8
9
  require_relative 'workbook/shared_string_table'
9
10
  require_relative 'workbook/style_sheet'
@@ -31,6 +32,8 @@ module OoxmlParser
31
32
  attr_accessor :pivot_table_definitions
32
33
  # @return [Array<DefinedName>] list of defined names
33
34
  attr_reader :defined_names
35
+ # @return [WorkbookProperties] workbook properties
36
+ attr_reader :workbook_properties
34
37
  # @return [WorkbookProtection] protection of workbook structure
35
38
  attr_reader :workbook_protection
36
39
 
@@ -137,6 +140,7 @@ module OoxmlParser
137
140
  parse_pivot_cache
138
141
  parse_pivot_table
139
142
  parse_defined_names
143
+ parse_workbook_properties
140
144
  parse_workbook_protection
141
145
  root_object.xmls_stack.pop
142
146
  self
@@ -170,6 +174,14 @@ module OoxmlParser
170
174
  end
171
175
  end
172
176
 
177
+ # Perform parsing of workbook properties
178
+ def parse_workbook_properties
179
+ workbook_properties = @doc.search('//xmlns:workbookPr').first
180
+ return nil unless workbook_properties
181
+
182
+ @workbook_properties = WorkbookProperties.new(parent: self).parse(workbook_properties)
183
+ end
184
+
173
185
  # Perform parsing of workbook protection
174
186
  def parse_workbook_protection
175
187
  workbook_protection = @doc.search('//xmlns:workbookProtection').first
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.31.0
4
+ version: 0.32.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-09-27 00:00:00.000000000 Z
13
+ date: 2022-10-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
@@ -312,6 +312,15 @@ files:
312
312
  - lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_object_attribute_helper.rb
313
313
  - lib/ooxml_parser/common_parser/common_data/paragraph.rb
314
314
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb
315
+ - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/bullet_image.rb
316
+ - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/numbering_properties.rb
317
+ - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb
318
+ - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_spacing.rb
319
+ - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_style_ref.rb
320
+ - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/spacing.rb
321
+ - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/spacing/line_spacing.rb
322
+ - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs.rb
323
+ - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs/tab.rb
315
324
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb
316
325
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb
317
326
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb
@@ -321,14 +330,6 @@ files:
321
330
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb
322
331
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb
323
332
  - lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/text.rb
324
- - lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
325
- - lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb
326
- - lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
327
- - lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_stlye_ref.rb
328
- - lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb
329
- - lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing/line_spacing.rb
330
- - lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb
331
- - lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/tab.rb
332
333
  - lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb
333
334
  - lib/ooxml_parser/common_parser/common_data/relationships.rb
334
335
  - lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb
@@ -532,6 +533,7 @@ files:
532
533
  - lib/ooxml_parser/xlsx_parser/workbook/style_sheet/xlsx_borders.rb
533
534
  - lib/ooxml_parser/xlsx_parser/workbook/style_sheet/xlsx_borders/xlsx_border.rb
534
535
  - lib/ooxml_parser/xlsx_parser/workbook/workbook_helpers.rb
536
+ - lib/ooxml_parser/xlsx_parser/workbook/workbook_properties.rb
535
537
  - lib/ooxml_parser/xlsx_parser/workbook/workbook_protection.rb
536
538
  - lib/ooxml_parser/xlsx_parser/workbook/worksheet.rb
537
539
  - lib/ooxml_parser/xlsx_parser/workbook/worksheet/excel_comments.rb