writeexcel 1.0.0 → 1.0.1
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 +4 -4
- data/README.rdoc +3 -59
- data/examples/chart_legend.rb +44 -0
- data/lib/writeexcel/chart.rb +2 -2
- data/lib/writeexcel/version.rb +1 -1
- data/test/perl_output/chart_legend.xls +0 -0
- data/test/test_example_match.rb +38 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20b416cc3748f15ad174799abf46360206cd2121
|
4
|
+
data.tar.gz: 75a4470abe845517634c386a89d6b7a147a741cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24ebdecf66d38da930c4c6b5b5ab7a242c42838d97651e42ccbaa009f78545cb9819f726ae2d578de14c41617e115da3c933e423de59a6d60520b59397ec18d6
|
7
|
+
data.tar.gz: e301135144176bb1af2ce65c15ee1f2a03aab117b262a489500b088c7e31920c15d4aa90f4f93d299b0194581e0736bad21bb7b7b30e32f0a5c19a2867d6d86f
|
data/README.rdoc
CHANGED
@@ -82,67 +82,11 @@ Example Code:
|
|
82
82
|
* and ......
|
83
83
|
|
84
84
|
== Recent Change
|
85
|
+
v1.0.1
|
86
|
+
* Bug fix issue 25. bug in Chart#set_legend.
|
87
|
+
|
85
88
|
v1.0.0
|
86
89
|
* Bug fix in Workbook#set_properties.
|
87
|
-
s
|
88
|
-
v0.6.19
|
89
|
-
* Bug fix in Worksheet#write_url_internal
|
90
|
-
|
91
|
-
v0.6.18
|
92
|
-
* Bug fix in compatibility_mode (Worksheet#write_number).
|
93
|
-
|
94
|
-
v0.6.17
|
95
|
-
* Bug fix in compatibility_mode (Worksheet#write_string).
|
96
|
-
|
97
|
-
v0.6.16
|
98
|
-
* typo fix
|
99
|
-
|
100
|
-
v0.6.15
|
101
|
-
* add Worksheet#merge_range_with_date_time : write datetime string to merged cells
|
102
|
-
|
103
|
-
v0.6.14
|
104
|
-
* Buf fix Issues 20. If more than 10 sheets, sheet reference mix up
|
105
|
-
|
106
|
-
v0.6.13
|
107
|
-
* Bug fix issue 19. Workbook#store_num_format, format written in utf8 raise exception.
|
108
|
-
|
109
|
-
v0.6.12
|
110
|
-
* Bug fix issue 17. Worksheet#store_formula shouldn't be private
|
111
|
-
|
112
|
-
v0.6.11
|
113
|
-
* Bug fix issue 15. Worksheet#write_comment on the same row overwrite other comments.
|
114
|
-
|
115
|
-
v0.6.10
|
116
|
-
* Bug fix. method missing split_string_setup() in shared_string_table.rb. see https://github.com/cxn03651/writeexcel/pull/13
|
117
|
-
|
118
|
-
v0.6.9
|
119
|
-
* Bug fix. When sheetname is cell's A1 notation such as 'D1', Worksheet#autofilter causes exception.
|
120
|
-
|
121
|
-
v0.6.8
|
122
|
-
* Bug fix. Worksheet#protect doesn't work well.
|
123
|
-
|
124
|
-
v0.6.7
|
125
|
-
* Bug fix. Worksheet#set_first_sheet doesn't work well.
|
126
|
-
* Bug fix. Worksheet#hide_zero doesn't work well.
|
127
|
-
* Bug fix. Worksheet#set_column - col width doesn't set to zero when pass hidden 1.
|
128
|
-
'
|
129
|
-
v0.6.6
|
130
|
-
* add private method to avoid warning: private attribute?
|
131
|
-
|
132
|
-
v0.6.5
|
133
|
-
* Bug fix. if workbook already has worksheet of utf8 name, Workbook#add_worksheet, Workbook#add_chart, Workbook#add_chart_ext raise exception when add new worksheet of utf8 name.
|
134
|
-
|
135
|
-
v0.6.4
|
136
|
-
* Bug fix. endless loop when inserted image size > 8224bytes.
|
137
|
-
|
138
|
-
v0.6.3
|
139
|
-
* Bug fix. endless loop when inserted image size > 8224.
|
140
|
-
|
141
|
-
v0.6.1
|
142
|
-
* Bug fix. to avoid output stack trace for debug when defined $debug such as Rails 2.3.8 development console.
|
143
|
-
|
144
|
-
v0.6.0
|
145
|
-
* Bug fix. to avoid destroy to_json method when using with Rails 3
|
146
90
|
|
147
91
|
== Author
|
148
92
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
#
|
4
|
+
###############################################################################
|
5
|
+
#
|
6
|
+
# Chart legend visible/invisible sample.
|
7
|
+
#
|
8
|
+
# copyright 2013 Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
|
9
|
+
#
|
10
|
+
require 'rubygems'
|
11
|
+
require 'writeexcel'
|
12
|
+
|
13
|
+
# Create a new workbook called chart_legend.xls and add a worksheet
|
14
|
+
workbook = WriteExcel.new('chart_legend.xls')
|
15
|
+
worksheet = workbook.add_worksheet
|
16
|
+
bold = workbook.add_format(:bold => 1)
|
17
|
+
|
18
|
+
# Add the worksheet data that the charts will refer to.
|
19
|
+
headings = [ 'Category', 'Values 1', 'Values 2' ]
|
20
|
+
data = [
|
21
|
+
[ 2, 3, 4, 5, 6, 7 ],
|
22
|
+
[ 1, 4, 5, 2, 1, 5 ],
|
23
|
+
[ 3, 6, 7, 5, 4, 3 ]
|
24
|
+
]
|
25
|
+
|
26
|
+
worksheet.write('A1', headings, bold)
|
27
|
+
worksheet.write('A2', data)
|
28
|
+
|
29
|
+
#
|
30
|
+
# chart with legend
|
31
|
+
#
|
32
|
+
chart1 = workbook.add_chart(:type => 'Chart::Area', :embedded => 1)
|
33
|
+
chart1.add_series( :values => '=Sheet1!$B$2:$B$7' )
|
34
|
+
worksheet.insert_chart('E2', chart1)
|
35
|
+
|
36
|
+
#
|
37
|
+
# chart without legend
|
38
|
+
#
|
39
|
+
chart2 = workbook.add_chart(:type => 'Chart::Area', :embedded => 1)
|
40
|
+
chart2.add_series( :values => '=Sheet1!$B$2:$B$7' )
|
41
|
+
chart2.set_legend(:position => 'none')
|
42
|
+
worksheet.insert_chart('E27', chart2)
|
43
|
+
|
44
|
+
workbook.close
|
data/lib/writeexcel/chart.rb
CHANGED
@@ -346,7 +346,7 @@ def set_title(params)
|
|
346
346
|
def set_legend(params = {})
|
347
347
|
if params.has_key?(:position)
|
348
348
|
if params[:position].downcase == 'none'
|
349
|
-
legend[:visible] = 0
|
349
|
+
@legend[:visible] = 0
|
350
350
|
end
|
351
351
|
end
|
352
352
|
end
|
@@ -1107,7 +1107,7 @@ def store_chartformat_stream # :nodoc:
|
|
1107
1107
|
|
1108
1108
|
# Note, the CHARTFORMATLINK record is only written by Excel.
|
1109
1109
|
|
1110
|
-
if @legend[:visible]
|
1110
|
+
if @legend[:visible] != 0
|
1111
1111
|
store_legend_stream
|
1112
1112
|
end
|
1113
1113
|
|
data/lib/writeexcel/version.rb
CHANGED
Binary file
|
data/test/test_example_match.rb
CHANGED
@@ -3455,4 +3455,42 @@ def test_properties
|
|
3455
3455
|
# do assertion
|
3456
3456
|
compare_file("#{PERL_OUTDIR}/properties.xls", @file)
|
3457
3457
|
end
|
3458
|
+
|
3459
|
+
def test_chart_legend
|
3460
|
+
workbook = WriteExcel.new(@file)
|
3461
|
+
worksheet = workbook.add_worksheet
|
3462
|
+
bold = workbook.add_format(:bold => 1)
|
3463
|
+
|
3464
|
+
# Add the worksheet data that the charts will refer to.
|
3465
|
+
headings = [ 'Category', 'Values 1', 'Values 2' ]
|
3466
|
+
data = [
|
3467
|
+
[ 2, 3, 4, 5, 6, 7 ],
|
3468
|
+
[ 1, 4, 5, 2, 1, 5 ],
|
3469
|
+
[ 3, 6, 7, 5, 4, 3 ]
|
3470
|
+
]
|
3471
|
+
|
3472
|
+
worksheet.write('A1', headings, bold)
|
3473
|
+
worksheet.write('A2', data)
|
3474
|
+
|
3475
|
+
|
3476
|
+
#
|
3477
|
+
# chart with legend
|
3478
|
+
#
|
3479
|
+
chart1 = workbook.add_chart(:type => 'Chart::Area', :embedded => 1)
|
3480
|
+
chart1.add_series( :values => '=Sheet1!$B$2:$B$7' )
|
3481
|
+
worksheet.insert_chart('E2', chart1)
|
3482
|
+
|
3483
|
+
#
|
3484
|
+
# chart without legend
|
3485
|
+
#
|
3486
|
+
chart2 = workbook.add_chart(:type => 'Chart::Area', :embedded => 1)
|
3487
|
+
chart2.add_series( :values => '=Sheet1!$B$2:$B$7' )
|
3488
|
+
chart2.set_legend(:position => 'none')
|
3489
|
+
worksheet.insert_chart('E27', chart2)
|
3490
|
+
|
3491
|
+
workbook.close
|
3492
|
+
|
3493
|
+
# do assertion
|
3494
|
+
compare_file("#{PERL_OUTDIR}/chart_legend.xls", @file)
|
3495
|
+
end
|
3458
3496
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: writeexcel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hideo NAKAMURA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Multiple worksheets can be added to a workbook and formatting can be
|
14
14
|
applied to cells. Text, numbers, formulas, hyperlinks and images can be written
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- examples/chart_area.rb
|
46
46
|
- examples/chart_bar.rb
|
47
47
|
- examples/chart_column.rb
|
48
|
+
- examples/chart_legend.rb
|
48
49
|
- examples/chart_line.rb
|
49
50
|
- examples/chart_pie.rb
|
50
51
|
- examples/chart_scatter.rb
|
@@ -166,6 +167,7 @@ files:
|
|
166
167
|
- test/perl_output/chart_area.xls
|
167
168
|
- test/perl_output/chart_bar.xls
|
168
169
|
- test/perl_output/chart_column.xls
|
170
|
+
- test/perl_output/chart_legend.xls
|
169
171
|
- test/perl_output/chart_line.xls
|
170
172
|
- test/perl_output/chess.xls
|
171
173
|
- test/perl_output/colors.xls
|
@@ -297,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
299
|
version: '0'
|
298
300
|
requirements: []
|
299
301
|
rubyforge_project:
|
300
|
-
rubygems_version: 2.0.
|
302
|
+
rubygems_version: 2.0.3
|
301
303
|
signing_key:
|
302
304
|
specification_version: 4
|
303
305
|
summary: Write to a cross-platform Excel binary file.
|
@@ -323,6 +325,7 @@ test_files:
|
|
323
325
|
- test/perl_output/chart_area.xls
|
324
326
|
- test/perl_output/chart_bar.xls
|
325
327
|
- test/perl_output/chart_column.xls
|
328
|
+
- test/perl_output/chart_legend.xls
|
326
329
|
- test/perl_output/chart_line.xls
|
327
330
|
- test/perl_output/chess.xls
|
328
331
|
- test/perl_output/colors.xls
|