writeexcel 0.3.5 → 0.4.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/.gitattributes +1 -0
- data/README.rdoc +12 -6
- data/VERSION +1 -1
- data/charts/chartex.rb +316 -315
- data/charts/demo1.rb +1 -0
- data/charts/demo2.rb +1 -0
- data/charts/demo3.rb +117 -116
- data/charts/demo4.rb +119 -118
- data/charts/demo5.rb +48 -47
- data/examples/a_simple.rb +1 -0
- data/examples/autofilter.rb +1 -0
- data/examples/bigfile.rb +30 -29
- data/examples/chart_area.rb +121 -120
- data/examples/chart_bar.rb +120 -119
- data/examples/chart_column.rb +120 -119
- data/examples/chart_line.rb +120 -119
- data/examples/chart_pie.rb +108 -107
- data/examples/chart_scatter.rb +121 -120
- data/examples/chart_stock.rb +148 -147
- data/examples/chess.rb +1 -0
- data/examples/colors.rb +1 -0
- data/examples/comments1.rb +1 -0
- data/examples/comments2.rb +3 -2
- data/examples/copyformat.rb +1 -0
- data/examples/data_validate.rb +1 -0
- data/examples/date_time.rb +1 -0
- data/examples/defined_name.rb +1 -0
- data/examples/demo.rb +1 -0
- data/examples/diag_border.rb +1 -0
- data/examples/formats.rb +1 -0
- data/examples/formula_result.rb +1 -0
- data/examples/header.rb +1 -0
- data/examples/hide_sheet.rb +1 -0
- data/examples/hyperlink.rb +1 -0
- data/examples/images.rb +1 -0
- data/examples/indent.rb +1 -0
- data/examples/merge1.rb +1 -0
- data/examples/merge2.rb +1 -0
- data/examples/merge3.rb +1 -0
- data/examples/merge4.rb +1 -0
- data/examples/merge5.rb +1 -0
- data/examples/merge6.rb +67 -66
- data/examples/outline.rb +1 -0
- data/examples/outline_collapsed.rb +1 -0
- data/examples/panes.rb +1 -0
- data/examples/properties.rb +1 -0
- data/examples/properties_jp.rb +1 -0
- data/examples/protection.rb +1 -0
- data/examples/regions.rb +1 -0
- data/examples/repeat.rb +1 -0
- data/examples/right_to_left.rb +1 -0
- data/examples/row_wrap.rb +1 -0
- data/examples/stats.rb +1 -0
- data/examples/stocks.rb +1 -0
- data/examples/tab_colors.rb +1 -0
- data/examples/write_arrays.rb +1 -0
- data/lib/writeexcel.rb +6 -1
- data/lib/writeexcel/biffwriter.rb +21 -20
- data/lib/writeexcel/chart.rb +25 -12
- data/lib/writeexcel/charts/area.rb +153 -152
- data/lib/writeexcel/charts/bar.rb +178 -177
- data/lib/writeexcel/charts/column.rb +157 -156
- data/lib/writeexcel/charts/external.rb +62 -61
- data/lib/writeexcel/charts/line.rb +153 -152
- data/lib/writeexcel/charts/pie.rb +170 -169
- data/lib/writeexcel/charts/scatter.rb +4 -3
- data/lib/writeexcel/charts/stock.rb +212 -211
- data/lib/writeexcel/compatibility.rb +320 -0
- data/lib/writeexcel/excelformulaparser.rb +587 -586
- data/lib/writeexcel/format.rb +12 -13
- data/lib/writeexcel/formula.rb +30 -28
- data/lib/writeexcel/helper.rb +23 -0
- data/lib/writeexcel/olewriter.rb +5 -16
- data/lib/writeexcel/properties.rb +43 -54
- data/lib/writeexcel/storage_lite.rb +981 -968
- data/lib/writeexcel/workbook.rb +94 -73
- data/lib/writeexcel/worksheet.rb +230 -210
- data/test/helper.rb +19 -0
- data/test/test_00_IEEE_double.rb +1 -0
- data/test/test_01_add_worksheet.rb +1 -0
- data/test/test_02_merge_formats.rb +3 -5
- data/test/test_04_dimensions.rb +3 -5
- data/test/test_05_rows.rb +6 -6
- data/test/test_06_extsst.rb +8 -8
- data/test/test_11_date_time.rb +3 -5
- data/test/test_12_date_only.rb +3 -5
- data/test/test_13_date_seconds.rb +4 -6
- data/test/test_21_escher.rb +3 -5
- data/test/test_22_mso_drawing_group.rb +20 -22
- data/test/test_23_note.rb +5 -7
- data/test/test_24_txo.rb +3 -5
- data/test/test_25_position_object.rb +84 -79
- data/test/test_26_autofilter.rb +3 -13
- data/test/test_27_autofilter.rb +3 -13
- data/test/test_28_autofilter.rb +3 -13
- data/test/test_29_process_jpg.rb +5 -0
- data/test/test_30_validation_dval.rb +3 -5
- data/test/test_31_validation_dv_strings.rb +3 -5
- data/test/test_32_validation_dv_formula.rb +3 -5
- data/test/test_40_property_types.rb +10 -9
- data/test/test_41_properties.rb +1 -0
- data/test/test_42_set_properties.rb +14 -15
- data/test/test_50_name_stored.rb +299 -302
- data/test/test_51_name_print_area.rb +357 -360
- data/test/test_52_name_print_titles.rb +454 -457
- data/test/test_53_autofilter.rb +203 -206
- data/test/test_60_chart_generic.rb +5 -0
- data/test/test_61_chart_subclasses.rb +95 -94
- data/test/test_62_chart_formats.rb +272 -267
- data/test/test_63_chart_area_formats.rb +649 -644
- data/test/test_biff.rb +12 -38
- data/test/test_compatibility.rb +627 -0
- data/test/test_example_match.rb +3 -18
- data/test/test_format.rb +46 -105
- data/test/test_formula.rb +1 -0
- data/test/test_ole.rb +3 -4
- data/test/test_storage_lite.rb +125 -146
- data/test/test_workbook.rb +2 -23
- data/test/test_worksheet.rb +4 -5
- data/utils/add_magic_comment.rb +80 -0
- data/writeexcel.gemspec +8 -2
- metadata +10 -4
data/test/test_workbook.rb
CHANGED
@@ -1,18 +1,16 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require 'helper'
|
2
3
|
require "stringio"
|
3
4
|
|
4
5
|
class TC_Workbook < Test::Unit::TestCase
|
5
6
|
|
6
7
|
def setup
|
7
|
-
|
8
|
-
path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
|
9
|
-
@test_file = File.join(Dir.tmpdir, path)
|
8
|
+
@test_file = StringIO.new
|
10
9
|
@workbook = Workbook.new(@test_file)
|
11
10
|
end
|
12
11
|
|
13
12
|
def teardown
|
14
13
|
@workbook.close
|
15
|
-
File.unlink(@test_file) if FileTest.exist?(@test_file)
|
16
14
|
end
|
17
15
|
|
18
16
|
def test_new
|
@@ -84,25 +82,6 @@ def test_raise_set_compatibility_after_sheet_creation
|
|
84
82
|
assert_raise(RuntimeError) { @workbook.compatibility_mode }
|
85
83
|
end
|
86
84
|
|
87
|
-
def test_write_to_io
|
88
|
-
# write to @test_file
|
89
|
-
@workbook.add_worksheet
|
90
|
-
@workbook.close
|
91
|
-
file = ''
|
92
|
-
File.open(@test_file, "rb") do |f|
|
93
|
-
file = f.read
|
94
|
-
end
|
95
|
-
|
96
|
-
# write to io
|
97
|
-
io = StringIO.new
|
98
|
-
wb = Workbook.new(io)
|
99
|
-
wb.add_worksheet
|
100
|
-
wb.close
|
101
|
-
|
102
|
-
# compare @test_file and io
|
103
|
-
assert_equal(file, io.string)
|
104
|
-
end
|
105
|
-
|
106
85
|
def valid_sheetname
|
107
86
|
[
|
108
87
|
# Tests for valid names
|
data/test/test_worksheet.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require 'helper'
|
3
|
+
require 'stringio'
|
2
4
|
|
3
5
|
class TC_Worksheet < Test::Unit::TestCase
|
4
6
|
TEST_DIR = File.expand_path(File.dirname(__FILE__))
|
5
7
|
PERL_OUTDIR = File.join(TEST_DIR, 'perl_output')
|
6
8
|
|
7
9
|
def setup
|
8
|
-
|
9
|
-
path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
|
10
|
-
@test_file = File.join(Dir.tmpdir, path)
|
10
|
+
@test_file = StringIO.new
|
11
11
|
@workbook = WriteExcel.new(@test_file)
|
12
12
|
@sheetname = 'test'
|
13
|
-
@ws = @workbook.add_worksheet(@sheetname,0)
|
13
|
+
@ws = @workbook.add_worksheet(@sheetname, 0)
|
14
14
|
@perldir = "#{PERL_OUTDIR}/"
|
15
15
|
@format = Format.new(:color=>"green")
|
16
16
|
end
|
@@ -19,7 +19,6 @@ def teardown
|
|
19
19
|
@ws = nil
|
20
20
|
@format = nil
|
21
21
|
@workbook.close
|
22
|
-
File.unlink(@test_file) if FileTest.exist?(@test_file)
|
23
22
|
end
|
24
23
|
|
25
24
|
def test_methods_exist
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
require 'stringio'
|
4
|
+
#
|
5
|
+
# magic commentを付与する
|
6
|
+
#
|
7
|
+
|
8
|
+
# カレントディレクトリ以下の.rbファイルパスの配列を返す
|
9
|
+
def rb_files
|
10
|
+
Dir.glob("./**/*\.rb")
|
11
|
+
end
|
12
|
+
|
13
|
+
# カレントディレクトリ以下の.orgファイルパスの配列を返す
|
14
|
+
def org_files
|
15
|
+
Dir.glob("./**/*\.org")
|
16
|
+
end
|
17
|
+
|
18
|
+
# ファイル名を*.orgに変更し、変更後のファイル名を返す
|
19
|
+
def rename_to_org(file)
|
20
|
+
orgfile = change_ext_name(file, 'org')
|
21
|
+
File.rename(file, orgfile)
|
22
|
+
orgfile
|
23
|
+
end
|
24
|
+
|
25
|
+
# ファイル名の拡張子を変更した際のフルパスを返す(実際の変更はしない)
|
26
|
+
def change_ext_name(file, new_ext)
|
27
|
+
File.join(File.dirname(file), File.basename(file, ".*")) + ".#{new_ext}"
|
28
|
+
end
|
29
|
+
|
30
|
+
# shebang か
|
31
|
+
def shebang?(line)
|
32
|
+
line =~ /^#!.*ruby/ ? true : false
|
33
|
+
end
|
34
|
+
|
35
|
+
# magic_comment か
|
36
|
+
def magic_comment?(line)
|
37
|
+
line =~ /coding[:=]\s*[\w.-]+/ ? true : false
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_magic_comment(input = nil, output = nil)
|
41
|
+
input ||= STDIN
|
42
|
+
output ||= STDOUT
|
43
|
+
|
44
|
+
magic_comment = "# -*- coding: utf-8 -*-\n"
|
45
|
+
if shebang?(line = input.gets)
|
46
|
+
output.write(line)
|
47
|
+
if magic_comment?(line = input.gets)
|
48
|
+
output.write(line)
|
49
|
+
else
|
50
|
+
output.write(magic_comment)
|
51
|
+
output.write(line)
|
52
|
+
end
|
53
|
+
elsif magic_comment?(line)
|
54
|
+
output.write(line)
|
55
|
+
else
|
56
|
+
output.write(magic_comment)
|
57
|
+
output.write(line)
|
58
|
+
end
|
59
|
+
while(line = input.gets)
|
60
|
+
output.write(line)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
if $0 == __FILE__
|
65
|
+
|
66
|
+
rb_files.each do |file|
|
67
|
+
orgfile = rename_to_org(file)
|
68
|
+
print("#{file}: renamed to #{orgfile}.\n")
|
69
|
+
io = StringIO.new
|
70
|
+
File.open(orgfile) do |fin|
|
71
|
+
File.open(file, 'w') { |fout| add_magic_comment(fin, fout) }
|
72
|
+
end
|
73
|
+
print("#{file}: contains magic comment.\n")
|
74
|
+
end
|
75
|
+
#
|
76
|
+
# orgファイルをすべて消すには、以下を有効に。
|
77
|
+
#
|
78
|
+
org_files.each { |f| File.unlink(f) }
|
79
|
+
|
80
|
+
end
|
data/writeexcel.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{writeexcel}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Hideo NAKAMURA"]
|
12
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-11}
|
13
13
|
s.description = %q{Multiple worksheets can be added to a workbook and formatting can be applied to cells. Text, numbers, formulas, hyperlinks and images can be written to the cells.}
|
14
14
|
s.email = %q{cxn03651@msj.biglobe.ne.jp}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
".document",
|
20
|
+
".gitattributes",
|
20
21
|
".gitignore",
|
21
22
|
"README.rdoc",
|
22
23
|
"Rakefile",
|
@@ -91,10 +92,12 @@ Gem::Specification.new do |s|
|
|
91
92
|
"lib/writeexcel/charts/pie.rb",
|
92
93
|
"lib/writeexcel/charts/scatter.rb",
|
93
94
|
"lib/writeexcel/charts/stock.rb",
|
95
|
+
"lib/writeexcel/compatibility.rb",
|
94
96
|
"lib/writeexcel/excelformula.y",
|
95
97
|
"lib/writeexcel/excelformulaparser.rb",
|
96
98
|
"lib/writeexcel/format.rb",
|
97
99
|
"lib/writeexcel/formula.rb",
|
100
|
+
"lib/writeexcel/helper.rb",
|
98
101
|
"lib/writeexcel/olewriter.rb",
|
99
102
|
"lib/writeexcel/properties.rb",
|
100
103
|
"lib/writeexcel/storage_lite.rb",
|
@@ -206,6 +209,7 @@ Gem::Specification.new do |s|
|
|
206
209
|
"test/test_62_chart_formats.rb",
|
207
210
|
"test/test_63_chart_area_formats.rb",
|
208
211
|
"test/test_biff.rb",
|
212
|
+
"test/test_compatibility.rb",
|
209
213
|
"test/test_example_match.rb",
|
210
214
|
"test/test_format.rb",
|
211
215
|
"test/test_formula.rb",
|
@@ -213,6 +217,7 @@ Gem::Specification.new do |s|
|
|
213
217
|
"test/test_storage_lite.rb",
|
214
218
|
"test/test_workbook.rb",
|
215
219
|
"test/test_worksheet.rb",
|
220
|
+
"utils/add_magic_comment.rb",
|
216
221
|
"writeexcel.gemspec",
|
217
222
|
"writeexcel.rdoc"
|
218
223
|
]
|
@@ -256,6 +261,7 @@ Gem::Specification.new do |s|
|
|
256
261
|
"test/test_62_chart_formats.rb",
|
257
262
|
"test/test_63_chart_area_formats.rb",
|
258
263
|
"test/test_biff.rb",
|
264
|
+
"test/test_compatibility.rb",
|
259
265
|
"test/test_example_match.rb",
|
260
266
|
"test/test_format.rb",
|
261
267
|
"test/test_formula.rb",
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
version: 0.4.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Hideo NAKAMURA
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-11 00:00:00 +09:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -28,6 +28,7 @@ extra_rdoc_files:
|
|
28
28
|
- README.rdoc
|
29
29
|
files:
|
30
30
|
- .document
|
31
|
+
- .gitattributes
|
31
32
|
- .gitignore
|
32
33
|
- README.rdoc
|
33
34
|
- Rakefile
|
@@ -102,10 +103,12 @@ files:
|
|
102
103
|
- lib/writeexcel/charts/pie.rb
|
103
104
|
- lib/writeexcel/charts/scatter.rb
|
104
105
|
- lib/writeexcel/charts/stock.rb
|
106
|
+
- lib/writeexcel/compatibility.rb
|
105
107
|
- lib/writeexcel/excelformula.y
|
106
108
|
- lib/writeexcel/excelformulaparser.rb
|
107
109
|
- lib/writeexcel/format.rb
|
108
110
|
- lib/writeexcel/formula.rb
|
111
|
+
- lib/writeexcel/helper.rb
|
109
112
|
- lib/writeexcel/olewriter.rb
|
110
113
|
- lib/writeexcel/properties.rb
|
111
114
|
- lib/writeexcel/storage_lite.rb
|
@@ -217,6 +220,7 @@ files:
|
|
217
220
|
- test/test_62_chart_formats.rb
|
218
221
|
- test/test_63_chart_area_formats.rb
|
219
222
|
- test/test_biff.rb
|
223
|
+
- test/test_compatibility.rb
|
220
224
|
- test/test_example_match.rb
|
221
225
|
- test/test_format.rb
|
222
226
|
- test/test_formula.rb
|
@@ -224,6 +228,7 @@ files:
|
|
224
228
|
- test/test_storage_lite.rb
|
225
229
|
- test/test_workbook.rb
|
226
230
|
- test/test_worksheet.rb
|
231
|
+
- utils/add_magic_comment.rb
|
227
232
|
- writeexcel.gemspec
|
228
233
|
- writeexcel.rdoc
|
229
234
|
has_rdoc: true
|
@@ -291,6 +296,7 @@ test_files:
|
|
291
296
|
- test/test_62_chart_formats.rb
|
292
297
|
- test/test_63_chart_area_formats.rb
|
293
298
|
- test/test_biff.rb
|
299
|
+
- test/test_compatibility.rb
|
294
300
|
- test/test_example_match.rb
|
295
301
|
- test/test_format.rb
|
296
302
|
- test/test_formula.rb
|