jruby-poi 0.8.2 → 0.9.0
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.
- data/.travis.yml +4 -2
- data/Gemfile +3 -3
- data/Gemfile.lock +23 -17
- data/README.markdown +4 -0
- data/VERSION +1 -1
- data/jruby-poi.gemspec +23 -28
- data/lib/ooxml-lib/stax-api-1.0.1.jar +0 -0
- data/lib/poi-3.8-20120326.jar +0 -0
- data/lib/{poi-examples-3.7-20101029.jar → poi-examples-3.8-20120326.jar} +0 -0
- data/lib/poi-excelant-3.8-20120326.jar +0 -0
- data/lib/poi-ooxml-3.8-20120326.jar +0 -0
- data/lib/{poi-ooxml-schemas-3.7-20101029.jar → poi-ooxml-schemas-3.8-20120326.jar} +0 -0
- data/lib/poi-scratchpad-3.8-20120326.jar +0 -0
- data/lib/poi.rb +5 -6
- data/lib/poi/workbook/area.rb +81 -81
- data/lib/poi/workbook/cell.rb +10 -10
- data/lib/poi/workbook/workbook.rb +10 -4
- data/spec/workbook_spec.rb +385 -370
- data/spec/writing_spec.rb +144 -146
- metadata +15 -25
- data/bin/autospec +0 -16
- data/bin/htmldiff +0 -16
- data/bin/ldiff +0 -16
- data/bin/rdebug +0 -16
- data/bin/rspec +0 -16
- data/lib/ooxml-lib/geronimo-stax-api_1.0_spec-1.0.jar +0 -0
- data/lib/poi-3.7-20101029.jar +0 -0
- data/lib/poi-ooxml-3.7-20101029.jar +0 -0
- data/lib/poi-scratchpad-3.7-20101029.jar +0 -0
data/spec/writing_spec.rb
CHANGED
@@ -1,146 +1,144 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
book
|
17
|
-
book.
|
18
|
-
book
|
19
|
-
book.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
:
|
40
|
-
|
41
|
-
:alignment => :align_center, :vertical_alignment => :vertical_center
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
title_cell =
|
54
|
-
|
55
|
-
|
56
|
-
sheet
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
header_cell =
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
cell.
|
75
|
-
|
76
|
-
|
77
|
-
cell.style =
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
sum_row =
|
86
|
-
|
87
|
-
|
88
|
-
cell = sum_row[
|
89
|
-
cell.style = form1_style
|
90
|
-
cell =
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
cell =
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
cell.style =
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
row_num += 1
|
104
|
-
sum_row =
|
105
|
-
|
106
|
-
|
107
|
-
cell =
|
108
|
-
cell
|
109
|
-
cell.
|
110
|
-
cell =
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
cell =
|
116
|
-
cell
|
117
|
-
cell.
|
118
|
-
cell =
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
data
|
127
|
-
|
128
|
-
|
129
|
-
row[cell_index].value = data #.to_java(:
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
end
|
146
|
-
end
|
1
|
+
require 'date'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
describe "writing Workbooks" do
|
5
|
+
it "should create a new empty workbook" do
|
6
|
+
name = 'new-workbook.xlsx'
|
7
|
+
book = POI::Workbook.create(name)
|
8
|
+
book.should_not be_nil
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should create a new workbook and write something to it" do
|
12
|
+
name = TestDataFile.expand_path("timesheet-#{Time.now.strftime('%Y%m%d%H%M%S%s')}.xlsx")
|
13
|
+
create_timesheet_spreadsheet(name)
|
14
|
+
book = POI::Workbook.open(name)
|
15
|
+
book.worksheets.size.should == 1
|
16
|
+
book.worksheets[0].name.should == 'Timesheet'
|
17
|
+
book.filename.should == name
|
18
|
+
book['Timesheet!A3'].should == 'Yegor Kozlov'
|
19
|
+
book.cell('Timesheet!J13').formula_value.should == 'SUM(J3:J12)'
|
20
|
+
FileUtils.rm_f name
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_timesheet_spreadsheet name='spec/data/timesheet.xlsx'
|
24
|
+
titles = ["Person", "ID", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Total\nHrs", "Overtime\nHrs", "Regular\nHrs"]
|
25
|
+
sample_data = [
|
26
|
+
["Yegor Kozlov", "YK", 5.0, 8.0, 10.0, 5.0, 5.0, 7.0, 6.0],
|
27
|
+
["Gisella Bronzetti", "GB", 4.0, 3.0, 1.0, 3.5, nil, nil, 4.0]
|
28
|
+
]
|
29
|
+
|
30
|
+
book = POI::Workbook.create(name)
|
31
|
+
title_style = book.create_style :font_height_in_points => 18, :boldweight => :boldweight_bold,
|
32
|
+
:alignment => :align_center, :vertical_alignment => :vertical_center
|
33
|
+
header_style = book.create_style :font_height_in_points => 11, :color => :white, :fill_foreground_color => :grey_50_percent,
|
34
|
+
:fill_pattern => :solid_foreground, :alignment => :align_center, :vertical_alignment => :vertical_center
|
35
|
+
cell_style = book.create_style :alignment => :align_center, :border_bottom => :border_thin, :border_top => :border_thin,
|
36
|
+
:border_left => :border_thin, :border_right => :border_thin, :bottom_border_color => :black,
|
37
|
+
:right_border_color => :black, :left_border_color => :black, :top_border_color => :black
|
38
|
+
form1_style = book.create_style :data_format => '0.00', :fill_pattern => :solid_foreground, :fill_foreground_color => :grey_25_percent,
|
39
|
+
:alignment => :align_center, :vertical_alignment => :vertical_center
|
40
|
+
form2_style = book.create_style :data_format => '0.00', :fill_pattern => :solid_foreground, :fill_foreground_color => :grey_40_percent,
|
41
|
+
:alignment => :align_center, :vertical_alignment => :vertical_center
|
42
|
+
|
43
|
+
sheet = book.create_sheet 'Timesheet'
|
44
|
+
print_setup = sheet.print_setup
|
45
|
+
print_setup.landscape = true
|
46
|
+
sheet.fit_to_page = true
|
47
|
+
sheet.horizontally_center = true
|
48
|
+
|
49
|
+
title_row = sheet.rows[0]
|
50
|
+
title_row.height_in_points = 45
|
51
|
+
title_cell = title_row.cells[0]
|
52
|
+
title_cell.value = 'Weekly Timesheet'
|
53
|
+
title_cell.style = title_style
|
54
|
+
sheet.add_merged_region org.apache.poi.ss.util.CellRangeAddress.valueOf("$A$1:$L$1")
|
55
|
+
|
56
|
+
header_row = sheet[1]
|
57
|
+
header_row.height_in_points = 40
|
58
|
+
titles.each_with_index do | title, index |
|
59
|
+
header_cell = header_row[index]
|
60
|
+
header_cell.value = title
|
61
|
+
header_cell.style = header_style
|
62
|
+
end
|
63
|
+
|
64
|
+
row_num = 2
|
65
|
+
10.times do
|
66
|
+
row = sheet[row_num]
|
67
|
+
row_num += 1
|
68
|
+
titles.each_with_index do | title, index |
|
69
|
+
cell = row[index]
|
70
|
+
if index == 9
|
71
|
+
cell.formula = "SUM(C#{row_num}:I#{row_num})"
|
72
|
+
cell.style = form1_style
|
73
|
+
elsif index == 11
|
74
|
+
cell.formula = "J#{row_num} - K#{row_num}"
|
75
|
+
cell.style = form1_style
|
76
|
+
else
|
77
|
+
cell.style = cell_style
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# row with totals below
|
83
|
+
sum_row = sheet[row_num]
|
84
|
+
row_num += 1
|
85
|
+
sum_row.height_in_points = 35
|
86
|
+
cell = sum_row[0]
|
87
|
+
cell.style = form1_style
|
88
|
+
cell = sum_row[1]
|
89
|
+
cell.style = form1_style
|
90
|
+
cell.value = 'Total Hrs:'
|
91
|
+
(2...12).each do | cell_index |
|
92
|
+
cell = sum_row[cell_index]
|
93
|
+
column = (?A.ord + cell_index).chr
|
94
|
+
cell.formula = "SUM(#{column}3:#{column}12)"
|
95
|
+
if cell_index > 9
|
96
|
+
cell.style = form2_style
|
97
|
+
else
|
98
|
+
cell.style = form1_style
|
99
|
+
end
|
100
|
+
end
|
101
|
+
row_num += 1
|
102
|
+
sum_row = sheet[row_num]
|
103
|
+
row_num += 1
|
104
|
+
sum_row.height_in_points = 25
|
105
|
+
cell = sum_row[0]
|
106
|
+
cell.value = 'Total Regular Hours'
|
107
|
+
cell.style = form1_style
|
108
|
+
cell = sum_row[1]
|
109
|
+
cell.formula = 'L13'
|
110
|
+
cell.style = form2_style
|
111
|
+
sum_row = sheet[row_num]
|
112
|
+
row_num += 1
|
113
|
+
cell = sum_row[0]
|
114
|
+
cell.value = 'Total Overtime Hours'
|
115
|
+
cell.style = form1_style
|
116
|
+
cell = sum_row[1]
|
117
|
+
cell.formula = 'K13'
|
118
|
+
cell.style = form2_style
|
119
|
+
|
120
|
+
# set sample data
|
121
|
+
sample_data.each_with_index do |each, row_index|
|
122
|
+
row = sheet[2 + row_index]
|
123
|
+
each.each_with_index do | data, cell_index |
|
124
|
+
data = sample_data[row_index][cell_index]
|
125
|
+
next unless data
|
126
|
+
if data.kind_of? String
|
127
|
+
row[cell_index].value = data #.to_java(:string)
|
128
|
+
else
|
129
|
+
row[cell_index].value = data #.to_java(:double)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# finally set column widths, the width is measured in units of 1/256th of a character width
|
135
|
+
sheet.set_column_width 0, 30*256 # 30 characters wide
|
136
|
+
(2..9).to_a.each do | column |
|
137
|
+
sheet.set_column_width column, 6*256 # 6 characters wide
|
138
|
+
end
|
139
|
+
sheet.set_column_width 10, 10*256 # 10 characters wide
|
140
|
+
|
141
|
+
book.save
|
142
|
+
File.exist?(name).should == true
|
143
|
+
end
|
144
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jruby-poi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.9.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Scott Deming
|
@@ -11,8 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date:
|
15
|
-
default_executable:
|
14
|
+
date: 2012-10-15 00:00:00 Z
|
16
15
|
dependencies:
|
17
16
|
- !ruby/object:Gem::Dependency
|
18
17
|
name: rspec
|
@@ -21,7 +20,7 @@ dependencies:
|
|
21
20
|
requirements:
|
22
21
|
- - ">="
|
23
22
|
- !ruby/object:Gem::Version
|
24
|
-
version: 2.
|
23
|
+
version: 2.11.0
|
25
24
|
requirement: *id001
|
26
25
|
prerelease: false
|
27
26
|
type: :development
|
@@ -32,12 +31,12 @@ dependencies:
|
|
32
31
|
requirements:
|
33
32
|
- - ">="
|
34
33
|
- !ruby/object:Gem::Version
|
35
|
-
version: 1.
|
34
|
+
version: 1.8.4
|
36
35
|
requirement: *id002
|
37
36
|
prerelease: false
|
38
37
|
type: :development
|
39
38
|
- !ruby/object:Gem::Dependency
|
40
|
-
name:
|
39
|
+
name: jruby-openssl
|
41
40
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
42
41
|
none: false
|
43
42
|
requirements:
|
@@ -51,12 +50,8 @@ description: A rubyesque library for manipulating spreadsheets and other documen
|
|
51
50
|
email:
|
52
51
|
- sdeming@makefile.com
|
53
52
|
- jacaetevha@gmail.com
|
54
|
-
executables:
|
55
|
-
|
56
|
-
- htmldiff
|
57
|
-
- ldiff
|
58
|
-
- rdebug
|
59
|
-
- rspec
|
53
|
+
executables: []
|
54
|
+
|
60
55
|
extensions: []
|
61
56
|
|
62
57
|
extra_rdoc_files:
|
@@ -71,20 +66,16 @@ files:
|
|
71
66
|
- README.markdown
|
72
67
|
- Rakefile
|
73
68
|
- VERSION
|
74
|
-
- bin/autospec
|
75
|
-
- bin/htmldiff
|
76
|
-
- bin/ldiff
|
77
|
-
- bin/rdebug
|
78
|
-
- bin/rspec
|
79
69
|
- jruby-poi.gemspec
|
80
70
|
- lib/ooxml-lib/dom4j-1.6.1.jar
|
81
|
-
- lib/ooxml-lib/
|
71
|
+
- lib/ooxml-lib/stax-api-1.0.1.jar
|
82
72
|
- lib/ooxml-lib/xmlbeans-2.3.0.jar
|
83
|
-
- lib/poi-3.
|
84
|
-
- lib/poi-examples-3.
|
85
|
-
- lib/poi-
|
86
|
-
- lib/poi-ooxml-
|
87
|
-
- lib/poi-
|
73
|
+
- lib/poi-3.8-20120326.jar
|
74
|
+
- lib/poi-examples-3.8-20120326.jar
|
75
|
+
- lib/poi-excelant-3.8-20120326.jar
|
76
|
+
- lib/poi-ooxml-3.8-20120326.jar
|
77
|
+
- lib/poi-ooxml-schemas-3.8-20120326.jar
|
78
|
+
- lib/poi-scratchpad-3.8-20120326.jar
|
88
79
|
- lib/poi.rb
|
89
80
|
- lib/poi/workbook.rb
|
90
81
|
- lib/poi/workbook/area.rb
|
@@ -107,7 +98,6 @@ files:
|
|
107
98
|
- spec/workbook_spec.rb
|
108
99
|
- spec/writing_spec.rb
|
109
100
|
- spec_debug.sh
|
110
|
-
has_rdoc: true
|
111
101
|
homepage: http://github.com/kameeoze/jruby-poi
|
112
102
|
licenses:
|
113
103
|
- Apache
|
@@ -134,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
124
|
requirements: []
|
135
125
|
|
136
126
|
rubyforge_project:
|
137
|
-
rubygems_version: 1.
|
127
|
+
rubygems_version: 1.8.24
|
138
128
|
signing_key:
|
139
129
|
specification_version: 3
|
140
130
|
summary: Apache POI class library for jruby
|
data/bin/autospec
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env jruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'autospec' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('rspec-core', 'autospec')
|
data/bin/htmldiff
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env jruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'htmldiff' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('diff-lcs', 'htmldiff')
|
data/bin/ldiff
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env jruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'ldiff' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('diff-lcs', 'ldiff')
|
data/bin/rdebug
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env jruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'rdebug' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('ruby-debug', 'rdebug')
|