rubyXL 1.2.7 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rubyXL/cell.rb +4 -1
- data/lib/rubyXL/parser.rb +10 -3
- data/lib/rubyXL/worksheet.rb +3 -2
- data/rubyXL.gemspec +2 -2
- data/spec/lib/parser_spec.rb +7 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.8
|
data/lib/rubyXL/cell.rb
CHANGED
data/lib/rubyXL/parser.rb
CHANGED
@@ -98,6 +98,12 @@ module RubyXL
|
|
98
98
|
|
99
99
|
#fills hashes for various styles
|
100
100
|
def Parser.fill_styles(wb,style_hash)
|
101
|
+
###NUM FORMATS###
|
102
|
+
if style_hash[:numFmts].nil?
|
103
|
+
style_hash[:numFmts] = {:attributes => {:count => 0}, :numFmt => []}
|
104
|
+
elsif style_hash[:numFmts][:attributes][:count]==1
|
105
|
+
style_hash[:numFmts][:numFmt] = [style_hash[:numFmts][:numFmt]]
|
106
|
+
end
|
101
107
|
wb.num_fmts = style_hash[:numFmts]
|
102
108
|
|
103
109
|
###FONTS###
|
@@ -336,6 +342,7 @@ module RubyXL
|
|
336
342
|
if File.directory?(File.join(dir_path,'xl','externalLinks'))
|
337
343
|
files['externalLinks'] = {}
|
338
344
|
ext_links_path = File.join(dir_path,'xl','externalLinks')
|
345
|
+
FileUtils.mkdir_p(ext_links_path)
|
339
346
|
files['externalLinks']['rels'] = []
|
340
347
|
dir = Dir.new(ext_links_path).entries.reject {|f| [".", "..", ".DS_Store", "_rels"].include? f}
|
341
348
|
|
@@ -354,7 +361,7 @@ module RubyXL
|
|
354
361
|
if File.directory?(File.join(dir_path,'xl','drawings'))
|
355
362
|
files['drawings'] = {}
|
356
363
|
drawings_path = File.join(dir_path,'xl','drawings','_rels')
|
357
|
-
|
364
|
+
FileUtils.mkdir_p(drawings_path)
|
358
365
|
dir = Dir.new(drawings_path).entries.reject {|f| [".", "..", ".DS_Store"].include? f}
|
359
366
|
dir.each_with_index do |draw,i|
|
360
367
|
files['drawings'][i+1] = File.read(File.join(drawings_path,draw))
|
@@ -364,7 +371,7 @@ module RubyXL
|
|
364
371
|
if File.directory?(File.join(dir_path,'xl','printerSettings'))
|
365
372
|
files['printerSettings'] = {}
|
366
373
|
printer_path = File.join(dir_path,'xl','printerSettings')
|
367
|
-
|
374
|
+
FileUtils.mkdir_p(printer_path)
|
368
375
|
dir = Dir.new(printer_path).entries.reject {|f| [".","..",".DS_Store"].include? f}
|
369
376
|
|
370
377
|
dir.each_with_index do |print, i|
|
@@ -375,7 +382,7 @@ module RubyXL
|
|
375
382
|
if File.directory?(File.join(dir_path,"xl",'worksheets','_rels'))
|
376
383
|
files['worksheetRels'] = {}
|
377
384
|
worksheet_rels_path = File.join(dir_path,'xl','worksheets','_rels')
|
378
|
-
|
385
|
+
FileUtils.mkdir_p(worksheet_rels_path)
|
379
386
|
dir = Dir.new(worksheet_rels_path).entries.reject {|f| [".","..",".DS_Store"].include? f}
|
380
387
|
dir.each_with_index do |rel, i|
|
381
388
|
files['worksheetRels'][i+1] = File.read(File.join(worksheet_rels_path,rel))
|
data/lib/rubyXL/worksheet.rb
CHANGED
@@ -32,8 +32,9 @@ class Worksheet < PrivateClass
|
|
32
32
|
end
|
33
33
|
|
34
34
|
#returns 2d array of just the cell values (without style or formula information)
|
35
|
-
def extract_data
|
36
|
-
|
35
|
+
def extract_data(args = {})
|
36
|
+
raw_values = args.delete(:raw) || false
|
37
|
+
return @sheet_data.map {|row| row.map {|c| if c.is_a?(Cell) then c.value(:raw => raw_values) else nil end}}
|
37
38
|
end
|
38
39
|
|
39
40
|
def get_table(headers=[],opts={})
|
data/rubyXL.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rubyXL}
|
8
|
-
s.version = "1.2.
|
8
|
+
s.version = "1.2.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Vivek Bhagwat"]
|
12
|
-
s.date = %q{2012-
|
12
|
+
s.date = %q{2012-07-11}
|
13
13
|
s.description = %q{rubyXL is a gem which allows the parsing, creation, and manipulation of Microsoft Excel (.xlsx/.xlsm) Documents}
|
14
14
|
s.email = %q{bhagwat.vivek@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/lib/parser_spec.rb
CHANGED
@@ -49,6 +49,13 @@ describe RubyXL::Parser do
|
|
49
49
|
@workbook2[0].sheet_data.should == @workbook[0].sheet_data
|
50
50
|
@workbook2[0].sheet_name.should == @workbook[0].sheet_name
|
51
51
|
end
|
52
|
+
|
53
|
+
it 'should construct consistent number formats' do
|
54
|
+
@workbook2 = RubyXL::Parser.parse(@file)
|
55
|
+
|
56
|
+
@workbook2.num_fmts[:numFmt].should be_an(Array)
|
57
|
+
@workbook2.num_fmts[:numFmt].length.should == @workbook2.num_fmts[:attributes][:count]
|
58
|
+
end
|
52
59
|
end
|
53
60
|
|
54
61
|
after do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyXL
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
9
|
+
- 8
|
10
10
|
segments_generated: true
|
11
|
-
version: 1.2.
|
11
|
+
version: 1.2.8
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Vivek Bhagwat
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-
|
19
|
+
date: 2012-07-11 00:00:00 -04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|