rubyXL 1.2.10 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/Gemfile +14 -10
  2. data/Gemfile.lock +80 -21
  3. data/LICENSE.txt +1 -1
  4. data/README.rdoc +88 -82
  5. data/Rakefile +7 -2
  6. data/VERSION +1 -1
  7. data/lib/rubyXL.rb +13 -7
  8. data/lib/rubyXL/cell.rb +108 -268
  9. data/lib/rubyXL/generic_storage.rb +40 -0
  10. data/lib/rubyXL/objects/border.rb +66 -0
  11. data/lib/rubyXL/objects/calculation_chain.rb +28 -0
  12. data/lib/rubyXL/objects/cell_style.rb +75 -0
  13. data/lib/rubyXL/objects/color.rb +25 -0
  14. data/lib/rubyXL/objects/column_range.rb +74 -0
  15. data/lib/rubyXL/objects/container_nodes.rb +122 -0
  16. data/lib/rubyXL/objects/data_validation.rb +43 -0
  17. data/lib/rubyXL/objects/document_properties.rb +76 -0
  18. data/lib/rubyXL/objects/extensions.rb +36 -0
  19. data/lib/rubyXL/objects/fill.rb +57 -0
  20. data/lib/rubyXL/objects/font.rb +111 -0
  21. data/lib/rubyXL/objects/formula.rb +24 -0
  22. data/lib/rubyXL/objects/ooxml_object.rb +295 -0
  23. data/lib/rubyXL/objects/reference.rb +110 -0
  24. data/lib/rubyXL/objects/relationships.rb +59 -0
  25. data/lib/rubyXL/objects/shared_strings.rb +57 -0
  26. data/lib/rubyXL/objects/sheet_data.rb +149 -0
  27. data/lib/rubyXL/objects/sheet_view.rb +71 -0
  28. data/lib/rubyXL/objects/stylesheet.rb +200 -0
  29. data/lib/rubyXL/objects/text.rb +87 -0
  30. data/lib/rubyXL/objects/theme.rb +64 -0
  31. data/lib/rubyXL/objects/workbook.rb +233 -0
  32. data/lib/rubyXL/objects/worksheet.rb +485 -0
  33. data/lib/rubyXL/parser.rb +78 -442
  34. data/lib/rubyXL/workbook.rb +216 -385
  35. data/lib/rubyXL/worksheet.rb +509 -1062
  36. data/lib/rubyXL/writer/content_types_writer.rb +104 -68
  37. data/lib/rubyXL/writer/core_writer.rb +26 -43
  38. data/lib/rubyXL/writer/generic_writer.rb +43 -0
  39. data/lib/rubyXL/writer/root_rels_writer.rb +11 -19
  40. data/lib/rubyXL/writer/styles_writer.rb +6 -398
  41. data/lib/rubyXL/writer/theme_writer.rb +321 -327
  42. data/lib/rubyXL/writer/workbook_writer.rb +63 -67
  43. data/lib/rubyXL/writer/worksheet_writer.rb +29 -218
  44. data/rdoc/created.rid +39 -0
  45. data/rdoc/fonts.css +167 -0
  46. data/rdoc/fonts/Lato-Light.ttf +0 -0
  47. data/rdoc/fonts/Lato-LightItalic.ttf +0 -0
  48. data/rdoc/fonts/Lato-Regular.ttf +0 -0
  49. data/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
  50. data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
  51. data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
  52. data/rdoc/images/add.png +0 -0
  53. data/rdoc/images/arrow_up.png +0 -0
  54. data/rdoc/images/brick.png +0 -0
  55. data/rdoc/images/brick_link.png +0 -0
  56. data/rdoc/images/bug.png +0 -0
  57. data/rdoc/images/bullet_black.png +0 -0
  58. data/rdoc/images/bullet_toggle_minus.png +0 -0
  59. data/rdoc/images/bullet_toggle_plus.png +0 -0
  60. data/rdoc/images/date.png +0 -0
  61. data/rdoc/images/delete.png +0 -0
  62. data/rdoc/images/find.png +0 -0
  63. data/rdoc/images/loadingAnimation.gif +0 -0
  64. data/rdoc/images/macFFBgHack.png +0 -0
  65. data/rdoc/images/package.png +0 -0
  66. data/rdoc/images/page_green.png +0 -0
  67. data/rdoc/images/page_white_text.png +0 -0
  68. data/rdoc/images/page_white_width.png +0 -0
  69. data/rdoc/images/plugin.png +0 -0
  70. data/rdoc/images/ruby.png +0 -0
  71. data/rdoc/images/tag_blue.png +0 -0
  72. data/rdoc/images/tag_green.png +0 -0
  73. data/rdoc/images/transparent.png +0 -0
  74. data/rdoc/images/wrench.png +0 -0
  75. data/rdoc/images/wrench_orange.png +0 -0
  76. data/rdoc/images/zoom.png +0 -0
  77. data/rdoc/js/darkfish.js +140 -0
  78. data/rdoc/js/jquery.js +18 -0
  79. data/rdoc/js/navigation.js +142 -0
  80. data/rdoc/js/search.js +109 -0
  81. data/rdoc/js/search_index.js +1 -0
  82. data/rdoc/js/searcher.js +228 -0
  83. data/rdoc/rdoc.css +580 -0
  84. data/rubyXL.gemspec +90 -34
  85. data/spec/lib/cell_spec.rb +29 -59
  86. data/spec/lib/parser_spec.rb +35 -19
  87. data/spec/lib/reference_spec.rb +29 -0
  88. data/spec/lib/stylesheet_spec.rb +29 -0
  89. data/spec/lib/workbook_spec.rb +22 -17
  90. data/spec/lib/worksheet_spec.rb +47 -202
  91. metadata +185 -148
  92. data/lib/.DS_Store +0 -0
  93. data/lib/rubyXL/Hash.rb +0 -60
  94. data/lib/rubyXL/color.rb +0 -14
  95. data/lib/rubyXL/private_class.rb +0 -265
  96. data/lib/rubyXL/writer/app_writer.rb +0 -62
  97. data/lib/rubyXL/writer/calc_chain_writer.rb +0 -33
  98. data/lib/rubyXL/writer/shared_strings_writer.rb +0 -30
  99. data/lib/rubyXL/writer/workbook_rels_writer.rb +0 -59
  100. data/lib/rubyXL/zip.rb +0 -20
  101. data/spec/lib/hash_spec.rb +0 -28
metadata CHANGED
@@ -1,218 +1,255 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rubyXL
3
- version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 2
9
- - 10
10
- segments_generated: true
11
- version: 1.2.10
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.1
5
+ prerelease:
12
6
  platform: ruby
13
- authors:
7
+ authors:
14
8
  - Vivek Bhagwat
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2012-08-07 00:00:00 -04:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
12
+ date: 2014-02-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nokogiri
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.4.4
22
+ type: :runtime
23
23
  prerelease: false
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.4.4
30
+ - !ruby/object:Gem::Dependency
31
+ name: rubyzip
32
+ requirement: !ruby/object:Gem::Requirement
25
33
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- segments_generated: true
33
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 1.0.0
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.0
46
+ - !ruby/object:Gem::Dependency
34
47
  name: shoulda
35
- requirement: *id001
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
36
54
  type: :development
37
- - !ruby/object:Gem::Dependency
38
55
  prerelease: false
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
40
57
  none: false
41
- requirements:
42
- - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 23
45
- segments:
46
- - 1
47
- - 0
48
- - 0
49
- segments_generated: true
50
- version: 1.0.0
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
51
63
  name: bundler
52
- requirement: *id002
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
53
70
  type: :development
54
- - !ruby/object:Gem::Dependency
55
71
  prerelease: false
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
57
73
  none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 15
62
- segments:
63
- - 1
64
- - 6
65
- - 0
66
- segments_generated: true
67
- version: 1.6.0
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
68
79
  name: jeweler
69
- requirement: *id003
70
- type: :development
71
- - !ruby/object:Gem::Dependency
72
- prerelease: false
73
- version_requirements: &id004 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
74
81
  none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- hash: 3
79
- segments:
80
- - 0
81
- segments_generated: true
82
- version: "0"
83
- name: rcov
84
- requirement: *id004
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
85
86
  type: :development
86
- - !ruby/object:Gem::Dependency
87
87
  prerelease: false
88
- version_requirements: &id005 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 15
94
- segments:
95
- - 1
96
- - 4
97
- - 4
98
- segments_generated: true
99
- version: 1.4.4
100
- name: nokogiri
101
- requirement: *id005
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: simplecov
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
102
  type: :development
103
- - !ruby/object:Gem::Dependency
104
103
  prerelease: false
105
- version_requirements: &id006 !ruby/object:Gem::Requirement
104
+ version_requirements: !ruby/object:Gem::Requirement
106
105
  none: false
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- hash: 51
111
- segments:
112
- - 0
113
- - 9
114
- - 4
115
- segments_generated: true
116
- version: 0.9.4
117
- name: rubyzip
118
- requirement: *id006
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rspec
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.3.4
119
118
  type: :development
120
- - !ruby/object:Gem::Dependency
121
119
  prerelease: false
122
- version_requirements: &id007 !ruby/object:Gem::Requirement
120
+ version_requirements: !ruby/object:Gem::Requirement
123
121
  none: false
124
- requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- hash: 19
128
- segments:
129
- - 1
130
- - 3
131
- - 4
132
- segments_generated: true
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
133
125
  version: 1.3.4
134
- name: rspec
135
- requirement: *id007
136
- type: :development
137
- description: rubyXL is a gem which allows the parsing, creation, and manipulation of Microsoft Excel (.xlsx/.xlsm) Documents
126
+ description: rubyXL is a gem which allows the parsing, creation, and manipulation
127
+ of Microsoft Excel (.xlsx/.xlsm) Documents
138
128
  email: bhagwat.vivek@gmail.com
139
129
  executables: []
140
-
141
130
  extensions: []
142
-
143
- extra_rdoc_files:
131
+ extra_rdoc_files:
144
132
  - LICENSE.txt
145
133
  - README.rdoc
146
- files:
134
+ files:
147
135
  - Gemfile
148
136
  - Gemfile.lock
149
137
  - LICENSE.txt
150
138
  - README.rdoc
151
139
  - Rakefile
152
140
  - VERSION
153
- - lib/.DS_Store
154
141
  - lib/rubyXL.rb
155
- - lib/rubyXL/Hash.rb
156
142
  - lib/rubyXL/cell.rb
157
- - lib/rubyXL/color.rb
143
+ - lib/rubyXL/generic_storage.rb
144
+ - lib/rubyXL/objects/border.rb
145
+ - lib/rubyXL/objects/calculation_chain.rb
146
+ - lib/rubyXL/objects/cell_style.rb
147
+ - lib/rubyXL/objects/color.rb
148
+ - lib/rubyXL/objects/column_range.rb
149
+ - lib/rubyXL/objects/container_nodes.rb
150
+ - lib/rubyXL/objects/data_validation.rb
151
+ - lib/rubyXL/objects/document_properties.rb
152
+ - lib/rubyXL/objects/extensions.rb
153
+ - lib/rubyXL/objects/fill.rb
154
+ - lib/rubyXL/objects/font.rb
155
+ - lib/rubyXL/objects/formula.rb
156
+ - lib/rubyXL/objects/ooxml_object.rb
157
+ - lib/rubyXL/objects/reference.rb
158
+ - lib/rubyXL/objects/relationships.rb
159
+ - lib/rubyXL/objects/shared_strings.rb
160
+ - lib/rubyXL/objects/sheet_data.rb
161
+ - lib/rubyXL/objects/sheet_view.rb
162
+ - lib/rubyXL/objects/stylesheet.rb
163
+ - lib/rubyXL/objects/text.rb
164
+ - lib/rubyXL/objects/theme.rb
165
+ - lib/rubyXL/objects/workbook.rb
166
+ - lib/rubyXL/objects/worksheet.rb
158
167
  - lib/rubyXL/parser.rb
159
- - lib/rubyXL/private_class.rb
160
168
  - lib/rubyXL/workbook.rb
161
169
  - lib/rubyXL/worksheet.rb
162
- - lib/rubyXL/writer/app_writer.rb
163
- - lib/rubyXL/writer/calc_chain_writer.rb
164
170
  - lib/rubyXL/writer/content_types_writer.rb
165
171
  - lib/rubyXL/writer/core_writer.rb
172
+ - lib/rubyXL/writer/generic_writer.rb
166
173
  - lib/rubyXL/writer/root_rels_writer.rb
167
- - lib/rubyXL/writer/shared_strings_writer.rb
168
174
  - lib/rubyXL/writer/styles_writer.rb
169
175
  - lib/rubyXL/writer/theme_writer.rb
170
- - lib/rubyXL/writer/workbook_rels_writer.rb
171
176
  - lib/rubyXL/writer/workbook_writer.rb
172
177
  - lib/rubyXL/writer/worksheet_writer.rb
173
- - lib/rubyXL/zip.rb
178
+ - rdoc/created.rid
179
+ - rdoc/fonts.css
180
+ - rdoc/fonts/Lato-Light.ttf
181
+ - rdoc/fonts/Lato-LightItalic.ttf
182
+ - rdoc/fonts/Lato-Regular.ttf
183
+ - rdoc/fonts/Lato-RegularItalic.ttf
184
+ - rdoc/fonts/SourceCodePro-Bold.ttf
185
+ - rdoc/fonts/SourceCodePro-Regular.ttf
186
+ - rdoc/images/add.png
187
+ - rdoc/images/arrow_up.png
188
+ - rdoc/images/brick.png
189
+ - rdoc/images/brick_link.png
190
+ - rdoc/images/bug.png
191
+ - rdoc/images/bullet_black.png
192
+ - rdoc/images/bullet_toggle_minus.png
193
+ - rdoc/images/bullet_toggle_plus.png
194
+ - rdoc/images/date.png
195
+ - rdoc/images/delete.png
196
+ - rdoc/images/find.png
197
+ - rdoc/images/loadingAnimation.gif
198
+ - rdoc/images/macFFBgHack.png
199
+ - rdoc/images/package.png
200
+ - rdoc/images/page_green.png
201
+ - rdoc/images/page_white_text.png
202
+ - rdoc/images/page_white_width.png
203
+ - rdoc/images/plugin.png
204
+ - rdoc/images/ruby.png
205
+ - rdoc/images/tag_blue.png
206
+ - rdoc/images/tag_green.png
207
+ - rdoc/images/transparent.png
208
+ - rdoc/images/wrench.png
209
+ - rdoc/images/wrench_orange.png
210
+ - rdoc/images/zoom.png
211
+ - rdoc/js/darkfish.js
212
+ - rdoc/js/jquery.js
213
+ - rdoc/js/navigation.js
214
+ - rdoc/js/search.js
215
+ - rdoc/js/search_index.js
216
+ - rdoc/js/searcher.js
217
+ - rdoc/rdoc.css
174
218
  - rubyXL.gemspec
175
219
  - spec/lib/cell_spec.rb
176
220
  - spec/lib/color_spec.rb
177
- - spec/lib/hash_spec.rb
178
221
  - spec/lib/parser_spec.rb
222
+ - spec/lib/reference_spec.rb
223
+ - spec/lib/stylesheet_spec.rb
179
224
  - spec/lib/workbook_spec.rb
180
225
  - spec/lib/worksheet_spec.rb
181
- has_rdoc: true
182
226
  homepage: http://github.com/gilt/rubyXL
183
- licenses:
227
+ licenses:
184
228
  - MIT
185
229
  post_install_message:
186
230
  rdoc_options: []
187
-
188
- require_paths:
231
+ require_paths:
189
232
  - lib
190
- required_ruby_version: !ruby/object:Gem::Requirement
233
+ required_ruby_version: !ruby/object:Gem::Requirement
191
234
  none: false
192
- requirements:
193
- - - ">="
194
- - !ruby/object:Gem::Version
195
- hash: 3
196
- segments:
235
+ requirements:
236
+ - - ! '>='
237
+ - !ruby/object:Gem::Version
238
+ version: '0'
239
+ segments:
197
240
  - 0
198
- segments_generated: true
199
- version: "0"
200
- required_rubygems_version: !ruby/object:Gem::Requirement
241
+ hash: 372152034824525214
242
+ required_rubygems_version: !ruby/object:Gem::Requirement
201
243
  none: false
202
- requirements:
203
- - - ">="
204
- - !ruby/object:Gem::Version
205
- hash: 3
206
- segments:
207
- - 0
208
- segments_generated: true
209
- version: "0"
244
+ requirements:
245
+ - - ! '>='
246
+ - !ruby/object:Gem::Version
247
+ version: '0'
210
248
  requirements: []
211
-
212
249
  rubyforge_project:
213
- rubygems_version: 1.3.7
250
+ rubygems_version: 1.8.23
214
251
  signing_key:
215
252
  specification_version: 3
216
- summary: rubyXL is a gem which allows the parsing, creation, and manipulation of Microsoft Excel (.xlsx/.xlsm) Documents
253
+ summary: rubyXL is a gem which allows the parsing, creation, and manipulation of Microsoft
254
+ Excel (.xlsx/.xlsm) Documents
217
255
  test_files: []
218
-
data/lib/.DS_Store DELETED
Binary file
data/lib/rubyXL/Hash.rb DELETED
@@ -1,60 +0,0 @@
1
- require 'rubygems'
2
- require 'nokogiri'
3
- # modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297
4
-
5
- module RubyXL
6
- # class Hash
7
- class Hash < ::Hash
8
- def self.from_xml(xml_io)
9
- begin
10
- result = Nokogiri::XML(xml_io)
11
- return { result.root.name.to_sym => xml_node_to_hash(result.root)}
12
- rescue Exception => e
13
- # raise your custom exception here
14
- end
15
- end
16
-
17
- def self.xml_node_to_hash(node)
18
- # If we are at the root of the document, start the hash
19
- if node.element?
20
- result_hash = {}
21
- if node.attributes != {}
22
- result_hash[:attributes] = {}
23
- node.attributes.keys.each do |key|
24
- result_hash[:attributes][node.attributes[key].name.to_sym] = prepare(node.attributes[key].value)
25
- end
26
- end
27
- if node.children.size > 0
28
- node.children.each do |child|
29
- result = xml_node_to_hash(child)
30
-
31
- if child.name == "text"
32
- unless child.next_sibling || child.previous_sibling
33
- return prepare(result)
34
- end
35
- elsif result_hash[child.name.to_sym]
36
- if result_hash[child.name.to_sym].is_a?(Object::Array)
37
- result_hash[child.name.to_sym] << prepare(result)
38
- else
39
- result_hash[child.name.to_sym] = [result_hash[child.name.to_sym]] << prepare(result)
40
- end
41
- else
42
- result_hash[child.name.to_sym] = prepare(result)
43
- end
44
- end
45
-
46
- return result_hash
47
- else
48
- return result_hash
49
- end
50
- else
51
- return prepare(node.content.to_s)
52
- end
53
- end
54
-
55
- def self.prepare(data)
56
- (data.class == String && data.to_i.to_s == data) ? data.to_i : data
57
- end
58
- end
59
- # end
60
- end