ooxl 0.0.1.4.4 → 0.0.1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 151eec32fedade6ddda1ceb1640dd96ea21b27e3
4
- data.tar.gz: 67e32ab6fa64205b3bdd8e130b441338f7cfface
3
+ metadata.gz: 5a2d4d295c1a337b528cb9e0c9dea5cbbcaf0ac1
4
+ data.tar.gz: 81230a0e5b6bec57206d77e7b7338269c1b64b1f
5
5
  SHA512:
6
- metadata.gz: 177c5802385bc0a0ce106c992379e91e2660db986990d4235a5a96aecbf647e2824dbcac06972ee5dd3f9c6e29b1bc8535b2702f98e0cfea7edb0887ec697dbb
7
- data.tar.gz: b921d5b3e6aa9208d15fba79ad3c5fee5c6c92ba166a6ab9e221ac11d94079a03f0e8debcc83d015d5c59f2397725c72aa63f65bc8ff378a6e140f8b3a717f73
6
+ metadata.gz: ca19b27dc3cfe9ff4163d7aad66e1cad74567beb3bdeed74a0be0ccddb20b973a0d186e71c087ddd686623d29d37453e02772b6ddb97c447b2ead9251514d1fa
7
+ data.tar.gz: adccbe47da55ea6d449369589ab814ce32a884f75c7938a768a987457cbec69327ce2b6b5748aa0a1eca662ff5f31f45899084c752a919f83ece15a7c1153409
data/lib/ooxl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class OOXL
2
- VERSION = "0.0.1.4.4"
2
+ VERSION = "0.0.1.4.5"
3
3
  end
@@ -0,0 +1,24 @@
1
+ class OOXL
2
+ class CellStyleReference
3
+ attr_accessor :id, :number_formatting_id, :fill_id, :font_id
4
+ def initialize(**attrs)
5
+ attrs.each { |property, value| send("#{property}=", value)}
6
+ end
7
+ def self.load_from_node(cell_style_xfs_node)
8
+ attributes = cell_style_xfs_node.attributes
9
+ self.new(
10
+ id: attributes["xfId"].value.to_i,
11
+ number_formatting_id: attributes["numFmtId"].value.to_i,
12
+ fill_id: attributes["fillId"].value.to_i,
13
+ font_id: attributes["fontId"].value.to_i
14
+ )
15
+ end
16
+ end
17
+ end
18
+
19
+ # <cellStyleXfs count="4">
20
+ # <xf numFmtId="0" fontId="0" fillId="0" borderId="0" />
21
+ # <xf numFmtId="0" fontId="1" fillId="0" borderId="0" />
22
+ # <xf numFmtId="0" fontId="39" fillId="0" borderId="0" applyProtection="0" />
23
+ # <xf numFmtId="9" fontId="1" fillId="0" borderId="0" applyFont="0" applyFill="0" applyBorder="0" applyAlignment="0" applyProtection="0" />
24
+ # </cellStyleXfs>
@@ -0,0 +1,74 @@
1
+ class OOXL
2
+ class Fill
3
+ attr_accessor :pattern_type, :fg_color, :fg_color_theme, :fg_color_tint, :bg_color_index, :bg_color, :fg_color_index
4
+
5
+ def initialize(**attrs)
6
+ attrs.each { |property, value| send("#{property}=", value)}
7
+ end
8
+ def self.load_from_node(fill_node)
9
+ pattern_fill = fill_node.at('patternFill')
10
+
11
+ pattern_type = pattern_fill.attributes["patternType"].value
12
+ if pattern_type == "solid"
13
+ fg_color = pattern_fill.at('fgColor')
14
+ bg_color = pattern_fill.at('bgColor')
15
+ fg_color_index = fg_color.class == Nokogiri::XML::Element ? fg_color.attributes["indexed"].try(:value) : nil
16
+
17
+ self.new(pattern_type: pattern_type,
18
+ fg_color: (fg_color.present?) ? fg_color.attributes["rgb"].try(:value) : nil,
19
+ fg_color_theme: (fg_color.present?) ? fg_color.attributes["theme"].try(:value) : nil,
20
+ fg_color_tint: (fg_color.present?) ? fg_color.attributes["tint"].try(:value) : nil,
21
+ bg_color: (bg_color.present?) ? bg_color.attributes["rgb"].try(:value) : nil,
22
+ bg_color_index: (bg_color.present?) ? bg_color.attributes["index"].try(:value) : nil,
23
+ fg_color_index: fg_color_index)
24
+ else
25
+ self.new(pattern_type: pattern_type)
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ # <fills count="9">
32
+ # <fill>
33
+ # <patternFill patternType="none" />
34
+ # </fill>
35
+ # <fill>
36
+ # <patternFill patternType="gray125" />
37
+ # </fill>
38
+ # <fill>
39
+ # <patternFill patternType="solid">
40
+ # <fgColor theme="0" tint="-0.249977111117893" />
41
+ # <bgColor indexed="64" />
42
+ # </patternFill>
43
+ # </fill>
44
+ # <fill>
45
+ # <patternFill patternType="solid">
46
+ # <fgColor theme="0" tint="-0.249977111117893" />
47
+ # <bgColor indexed="31" />
48
+ # </patternFill>
49
+ # </fill>
50
+ # <fill>
51
+ # <patternFill patternType="solid">
52
+ # <fgColor theme="0" tint="-4.9989318521683403E-2" />
53
+ # <bgColor indexed="64" />
54
+ # </patternFill>
55
+ # </fill>
56
+ # <fill>
57
+ # <patternFill patternType="solid">
58
+ # <fgColor rgb="FFFFFF00" />
59
+ # <bgColor indexed="64" />
60
+ # </patternFill>
61
+ # </fill>
62
+ # <fill>
63
+ # <patternFill patternType="solid">
64
+ # <fgColor theme="0" tint="-0.24994659260841701" />
65
+ # <bgColor indexed="64" />
66
+ # </patternFill>
67
+ # </fill>
68
+ # <fill>
69
+ # <patternFill patternType="solid">
70
+ # <fgColor rgb="FFFFCC99" />
71
+ # <bgColor indexed="64" />
72
+ # </patternFill>
73
+ # </fill>
74
+ # </fills>
@@ -0,0 +1,41 @@
1
+ class OOXL
2
+ class Font
3
+ attr_accessor :size, :name, :rgb_color, :theme, :bold, :color_index
4
+ alias_method :bold?, :bold
5
+ def initialize(**attrs)
6
+ attrs.each { |property, value| send("#{property}=", value)}
7
+ end
8
+ def self.load_from_node(font_node)
9
+ font_size_node = font_node.at('sz')
10
+ font_color_node = font_node.at('color')
11
+ font_name_node = font_node.at('name')
12
+ font_bold_node = font_node.at('b')
13
+ self.new(
14
+ size: font_size_node && font_size_node.attributes["val"].value,
15
+ name: font_name_node && font_name_node.attributes["val"].value,
16
+ rgb_color: font_color_node && font_color_node.attributes["rgb"].try(:value) ,
17
+ color_index: font_color_node && font_color_node.attributes["indexed"].try(:value),
18
+ theme: font_color_node && font_color_node.attributes["theme"].try(:value),
19
+ bold: font_bold_node.present?,
20
+ )
21
+ end
22
+ end
23
+ end
24
+
25
+ # <fonts count="3">
26
+ # <font>
27
+ # <sz val="10" />
28
+ # <name val="Arial" />
29
+ # </font>
30
+ # <font>
31
+ # <sz val="10" />
32
+ # <name val="Arial" />
33
+ # <family val="2" />
34
+ # </font>
35
+ # <font>
36
+ # <b />
37
+ # <sz val="9" />
38
+ # <name val="Arial" />
39
+ # <family val="2" />
40
+ # </font>
41
+ # </fonts>
@@ -1,12 +1,10 @@
1
1
  class OOXL
2
- class Styles
3
- class NumberFormatting
4
- attr_accessor :id, :code
5
- def self.load_from_node(num_fmt_node)
6
- new_format = self.new.tap do |number_format|
7
- number_format.id = num_fmt_node.attributes["numFmtId"].try(:value)
8
- number_format.code = num_fmt_node.attributes["formatCode"].try(:value)
9
- end
2
+ class NumberFormatting
3
+ attr_accessor :id, :code
4
+ def self.load_from_node(num_fmt_node)
5
+ new_format = self.new.tap do |number_format|
6
+ number_format.id = num_fmt_node.attributes["numFmtId"].try(:value)
7
+ number_format.code = num_fmt_node.attributes["formatCode"].try(:value)
10
8
  end
11
9
  end
12
10
  end
@@ -1,7 +1,7 @@
1
- require_relative 'styles/cell_style_reference'
2
- require_relative 'styles/fill'
3
- require_relative 'styles/font'
4
- require_relative 'styles/number_formatting'
1
+ require_relative 'cell_style_reference'
2
+ require_relative 'fill'
3
+ require_relative 'font'
4
+ require_relative 'number_formatting'
5
5
  class OOXL
6
6
  class Styles
7
7
  attr_accessor :fonts, :fills, :number_formats, :cell_style_xfs
@@ -41,10 +41,10 @@ class OOXL
41
41
  cell_style_xfs = style_doc.xpath('//cellXfs/xf')
42
42
 
43
43
  self.new(
44
- fonts: fonts.map { |font_node| Styles::Font.load_from_node(font_node)},
45
- fills: fills.map { |fill_node| Styles::Fill.load_from_node(fill_node) if fill_node.to_s.include?('patternFill')},
46
- number_formats: number_formats.map { |num_fmt_node| Styles::NumberFormatting.load_from_node(num_fmt_node) },
47
- cell_style_xfs: cell_style_xfs.map { |cell_style_xfs_node| Styles::CellStyleReference.load_from_node(cell_style_xfs_node)}
44
+ fonts: fonts.map { |font_node| Font.load_from_node(font_node)},
45
+ fills: fills.map { |fill_node| Fill.load_from_node(fill_node) if fill_node.to_s.include?('patternFill')},
46
+ number_formats: number_formats.map { |num_fmt_node| NumberFormatting.load_from_node(num_fmt_node) },
47
+ cell_style_xfs: cell_style_xfs.map { |cell_style_xfs_node| CellStyleReference.load_from_node(cell_style_xfs_node)}
48
48
  )
49
49
  end
50
50
  end
data/ooxml_excel.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["bajong009@gmail.com"]
11
11
  spec.summary = %q{OOXL Excel - Parse Excel Spreadsheets (xlsx, xlsm).}
12
12
  spec.description = %q{A Ruby spreadsheet parser for Excel (xlsx, xlsm).}
13
- spec.homepage = "https://github.com/halcjames/ooxml_excel"
13
+ spec.homepage = "https://github.com/halcjames/ooxl"
14
14
 
15
15
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
16
  # to allow pushing to a single host or delete this section to allow pushing to any host.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ooxl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.4.4
4
+ version: 0.0.1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Mones
@@ -121,20 +121,20 @@ files:
121
121
  - lib/ooxl/util.rb
122
122
  - lib/ooxl/version.rb
123
123
  - lib/ooxl/xl_objects/cell.rb
124
+ - lib/ooxl/xl_objects/cell_style_reference.rb
124
125
  - lib/ooxl/xl_objects/column.rb
125
126
  - lib/ooxl/xl_objects/comments.rb
127
+ - lib/ooxl/xl_objects/fill.rb
128
+ - lib/ooxl/xl_objects/font.rb
129
+ - lib/ooxl/xl_objects/number_formatting.rb
126
130
  - lib/ooxl/xl_objects/relationships.rb
127
131
  - lib/ooxl/xl_objects/row.rb
128
132
  - lib/ooxl/xl_objects/sheet.rb
129
133
  - lib/ooxl/xl_objects/sheet/data_validation.rb
130
134
  - lib/ooxl/xl_objects/styles.rb
131
- - lib/ooxl/xl_objects/styles/cell_style_reference.rb
132
- - lib/ooxl/xl_objects/styles/fill.rb
133
- - lib/ooxl/xl_objects/styles/font.rb
134
- - lib/ooxl/xl_objects/styles/number_formatting.rb
135
135
  - lib/ooxl/xl_objects/workbook.rb
136
136
  - ooxml_excel.gemspec
137
- homepage: https://github.com/halcjames/ooxml_excel
137
+ homepage: https://github.com/halcjames/ooxl
138
138
  licenses: []
139
139
  metadata: {}
140
140
  post_install_message:
@@ -1,26 +0,0 @@
1
- class OOXL
2
- class Styles
3
- class CellStyleReference
4
- attr_accessor :id, :number_formatting_id, :fill_id, :font_id
5
- def initialize(**attrs)
6
- attrs.each { |property, value| send("#{property}=", value)}
7
- end
8
- def self.load_from_node(cell_style_xfs_node)
9
- attributes = cell_style_xfs_node.attributes
10
- self.new(
11
- id: attributes["xfId"].value.to_i,
12
- number_formatting_id: attributes["numFmtId"].value.to_i,
13
- fill_id: attributes["fillId"].value.to_i,
14
- font_id: attributes["fontId"].value.to_i
15
- )
16
- end
17
- end
18
- end
19
- end
20
-
21
- # <cellStyleXfs count="4">
22
- # <xf numFmtId="0" fontId="0" fillId="0" borderId="0" />
23
- # <xf numFmtId="0" fontId="1" fillId="0" borderId="0" />
24
- # <xf numFmtId="0" fontId="39" fillId="0" borderId="0" applyProtection="0" />
25
- # <xf numFmtId="9" fontId="1" fillId="0" borderId="0" applyFont="0" applyFill="0" applyBorder="0" applyAlignment="0" applyProtection="0" />
26
- # </cellStyleXfs>
@@ -1,76 +0,0 @@
1
- class OOXL
2
- class Styles
3
- class Fill
4
- attr_accessor :pattern_type, :fg_color, :fg_color_theme, :fg_color_tint, :bg_color_index, :bg_color, :fg_color_index
5
-
6
- def initialize(**attrs)
7
- attrs.each { |property, value| send("#{property}=", value)}
8
- end
9
- def self.load_from_node(fill_node)
10
- pattern_fill = fill_node.at('patternFill')
11
-
12
- pattern_type = pattern_fill.attributes["patternType"].value
13
- if pattern_type == "solid"
14
- fg_color = pattern_fill.at('fgColor')
15
- bg_color = pattern_fill.at('bgColor')
16
- fg_color_index = fg_color.class == Nokogiri::XML::Element ? fg_color.attributes["indexed"].try(:value) : nil
17
-
18
- self.new(pattern_type: pattern_type,
19
- fg_color: (fg_color.present?) ? fg_color.attributes["rgb"].try(:value) : nil,
20
- fg_color_theme: (fg_color.present?) ? fg_color.attributes["theme"].try(:value) : nil,
21
- fg_color_tint: (fg_color.present?) ? fg_color.attributes["tint"].try(:value) : nil,
22
- bg_color: (bg_color.present?) ? bg_color.attributes["rgb"].try(:value) : nil,
23
- bg_color_index: (bg_color.present?) ? bg_color.attributes["index"].try(:value) : nil,
24
- fg_color_index: fg_color_index)
25
- else
26
- self.new(pattern_type: pattern_type)
27
- end
28
- end
29
- end
30
- end
31
- end
32
-
33
- # <fills count="9">
34
- # <fill>
35
- # <patternFill patternType="none" />
36
- # </fill>
37
- # <fill>
38
- # <patternFill patternType="gray125" />
39
- # </fill>
40
- # <fill>
41
- # <patternFill patternType="solid">
42
- # <fgColor theme="0" tint="-0.249977111117893" />
43
- # <bgColor indexed="64" />
44
- # </patternFill>
45
- # </fill>
46
- # <fill>
47
- # <patternFill patternType="solid">
48
- # <fgColor theme="0" tint="-0.249977111117893" />
49
- # <bgColor indexed="31" />
50
- # </patternFill>
51
- # </fill>
52
- # <fill>
53
- # <patternFill patternType="solid">
54
- # <fgColor theme="0" tint="-4.9989318521683403E-2" />
55
- # <bgColor indexed="64" />
56
- # </patternFill>
57
- # </fill>
58
- # <fill>
59
- # <patternFill patternType="solid">
60
- # <fgColor rgb="FFFFFF00" />
61
- # <bgColor indexed="64" />
62
- # </patternFill>
63
- # </fill>
64
- # <fill>
65
- # <patternFill patternType="solid">
66
- # <fgColor theme="0" tint="-0.24994659260841701" />
67
- # <bgColor indexed="64" />
68
- # </patternFill>
69
- # </fill>
70
- # <fill>
71
- # <patternFill patternType="solid">
72
- # <fgColor rgb="FFFFCC99" />
73
- # <bgColor indexed="64" />
74
- # </patternFill>
75
- # </fill>
76
- # </fills>
@@ -1,42 +0,0 @@
1
- class OOXL
2
- class Styles
3
- class Font
4
- attr_accessor :size, :name, :rgb_color, :theme, :bold
5
- alias_method :bold?, :bold
6
- def initialize(**attrs)
7
- attrs.each { |property, value| send("#{property}=", value)}
8
- end
9
- def self.load_from_node(font_node)
10
- font_size_node = font_node.at('sz')
11
- font_color_node = font_node.at('color')
12
- font_name_node = font_node.at('name')
13
- font_bold_node = font_node.at('b')
14
- self.new(
15
- size: font_size_node && font_size_node.attributes["val"].value,
16
- name: font_name_node && font_name_node.attributes["val"].value,
17
- rgb_color: font_color_node && font_color_node.attributes["rgb"].try(:value) ,
18
- theme: font_color_node && font_color_node.attributes["theme"].try(:value),
19
- bold: font_bold_node.present?
20
- )
21
- end
22
- end
23
- end
24
- end
25
-
26
- # <fonts count="3">
27
- # <font>
28
- # <sz val="10" />
29
- # <name val="Arial" />
30
- # </font>
31
- # <font>
32
- # <sz val="10" />
33
- # <name val="Arial" />
34
- # <family val="2" />
35
- # </font>
36
- # <font>
37
- # <b />
38
- # <sz val="9" />
39
- # <name val="Arial" />
40
- # <family val="2" />
41
- # </font>
42
- # </fonts>