spreadsheet 0.6.3 → 0.6.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +30 -0
- data/lib/spreadsheet.rb +1 -1
- data/lib/spreadsheet/column.rb +1 -0
- data/lib/spreadsheet/datatypes.rb +6 -3
- data/lib/spreadsheet/excel/reader.rb +49 -9
- data/lib/spreadsheet/excel/sst_entry.rb +1 -0
- data/lib/spreadsheet/excel/worksheet.rb +1 -0
- data/lib/spreadsheet/excel/writer/workbook.rb +16 -1
- data/lib/spreadsheet/excel/writer/worksheet.rb +16 -14
- data/lib/spreadsheet/format.rb +5 -0
- data/lib/spreadsheet/link.rb +2 -1
- data/lib/spreadsheet/row.rb +1 -0
- data/lib/spreadsheet/workbook.rb +0 -1
- data/lib/spreadsheet/worksheet.rb +42 -35
- data/test/integration.rb +10 -10
- metadata +4 -4
data/History.txt
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
=== 0.6.3.1 / 2009-02-13
|
2
|
+
|
3
|
+
* 3 Bugfixes
|
4
|
+
|
5
|
+
* Only selects the First Worksheet by default
|
6
|
+
This deals with an issue reported by Biörn Andersson in
|
7
|
+
http://rubyforge.org/tracker/?func=detail&atid=2677&aid=23736&group_id=678
|
8
|
+
where data-edits in OpenOffice were propagated through all selected
|
9
|
+
sheets.
|
10
|
+
|
11
|
+
* Honors Row, Column, Worksheet and Workbook-formats
|
12
|
+
and thus fixes a Bug introduced in
|
13
|
+
http://scm.ywesee.com/?p=spreadsheet;a=commit;h=52755ad76fdda151564b689107ca2fbb80af3b78
|
14
|
+
and reported in
|
15
|
+
http://rubyforge.org/tracker/index.php?func=detail&aid=23875&group_id=678&atid=2678
|
16
|
+
and by Joachim Schneider in
|
17
|
+
http://rubyforge.org/forum/forum.php?thread_id=31056&forum_id=2920
|
18
|
+
|
19
|
+
* Fixes a bug reported by Alexander Skwar in
|
20
|
+
http://rubyforge.org/forum/forum.php?thread_id=31403&forum_id=2920
|
21
|
+
where the user-defined formatting of Dates and Times was overwritten with
|
22
|
+
a default format, and other issues connected with writing Dates and Times
|
23
|
+
into Spreadsheets.
|
24
|
+
|
25
|
+
* 1 minor enhancements
|
26
|
+
|
27
|
+
* Spreadsheet shold now be completely warning-free,
|
28
|
+
as requested by Eric Peterson in
|
29
|
+
http://rubyforge.org/forum/forum.php?thread_id=31346&forum_id=2920
|
30
|
+
|
1
31
|
=== 0.6.3 / 2009-01-14
|
2
32
|
|
3
33
|
* 1 Bugfix
|
data/lib/spreadsheet.rb
CHANGED
data/lib/spreadsheet/column.rb
CHANGED
@@ -21,10 +21,11 @@ class << self
|
|
21
21
|
def boolean *args
|
22
22
|
args.each do |key|
|
23
23
|
define_method key do
|
24
|
-
|
24
|
+
name = "@#{key}"
|
25
|
+
!!(instance_variable_get(name) if instance_variables.include?(name))
|
25
26
|
end
|
26
27
|
define_method "#{key}?" do
|
27
|
-
|
28
|
+
send key
|
28
29
|
end
|
29
30
|
define_method "#{key}=" do |arg|
|
30
31
|
arg = false if arg == 0
|
@@ -73,7 +74,9 @@ class << self
|
|
73
74
|
aliases.store value, value
|
74
75
|
end
|
75
76
|
define_method key do
|
76
|
-
|
77
|
+
name = "@#{key}"
|
78
|
+
value = instance_variable_get(name) if instance_variables.include? name
|
79
|
+
value || values.first
|
77
80
|
end
|
78
81
|
define_method "#{key}=" do |arg|
|
79
82
|
if arg
|
@@ -26,7 +26,9 @@ class Reader
|
|
26
26
|
[1].pack('l') != "\001\000\000\000"
|
27
27
|
}
|
28
28
|
@opts = opts
|
29
|
+
@boundsheets = nil
|
29
30
|
@current_row_block = {}
|
31
|
+
@current_row_block_offset = nil
|
30
32
|
@formats = {}
|
31
33
|
BUILTIN_FORMATS.each do |key, fmt| @formats.store key, client(fmt, 'UTF-8') end
|
32
34
|
end
|
@@ -183,7 +185,7 @@ class Reader
|
|
183
185
|
else
|
184
186
|
@boundsheets = [1, pos, len]
|
185
187
|
end
|
186
|
-
@workbook.set_boundsheets
|
188
|
+
@workbook.set_boundsheets(*@boundsheets)
|
187
189
|
@workbook.add_worksheet Worksheet.new(:name => name,
|
188
190
|
:ole => @book,
|
189
191
|
:offset => offset,
|
@@ -710,6 +712,50 @@ class Reader
|
|
710
712
|
value = client read_string(work[6..-1], 2), @workbook.encoding
|
711
713
|
set_cell worksheet, row, column, xf, value
|
712
714
|
end
|
715
|
+
def read_window2 worksheet, work, pos, len
|
716
|
+
# This record contains additional settings for the document window
|
717
|
+
# (BIFF2-BIFF4) or for the window of a specific worksheet (BIFF5-BIFF8).
|
718
|
+
# It is part of the Sheet View Settings Block (➜ 4.5).
|
719
|
+
# Offset Size Contents
|
720
|
+
# 0 2 Option flags:
|
721
|
+
# Bits Mask Contents
|
722
|
+
# 0 0x0001 0 = Show formula results
|
723
|
+
# 1 = Show formulas
|
724
|
+
# 1 0x0002 0 = Do not show grid lines
|
725
|
+
# 1 = Show grid lines
|
726
|
+
# 2 0x0004 0 = Do not show sheet headers
|
727
|
+
# 1 = Show sheet headers
|
728
|
+
# 3 0x0008 0 = Panes are not frozen
|
729
|
+
# 1 = Panes are frozen (freeze)
|
730
|
+
# 4 0x0010 0 = Show zero values as empty cells
|
731
|
+
# 1 = Show zero values
|
732
|
+
# 5 0x0020 0 = Manual grid line colour
|
733
|
+
# 1 = Automatic grid line colour
|
734
|
+
# 6 0x0040 0 = Columns from left to right
|
735
|
+
# 1 = Columns from right to left
|
736
|
+
# 7 0x0080 0 = Do not show outline symbols
|
737
|
+
# 1 = Show outline symbols
|
738
|
+
# 8 0x0100 0 = Keep splits if pane freeze is removed
|
739
|
+
# 1 = Remove splits if pane freeze is removed
|
740
|
+
# 9 0x0200 0 = Sheet not selected
|
741
|
+
# 1 = Sheet selected (BIFF5-BIFF8)
|
742
|
+
# 10 0x0400 0 = Sheet not active
|
743
|
+
# 1 = Sheet active (BIFF5-BIFF8)
|
744
|
+
# 11 0x0800 0 = Show in normal view
|
745
|
+
# 1 = Show in page break preview (BIFF8)
|
746
|
+
# 2 2 Index to first visible row
|
747
|
+
# 4 2 Index to first visible column
|
748
|
+
# 6 2 Colour index of grid line colour (➜ 5.74).
|
749
|
+
# Note that in BIFF2-BIFF5 an RGB colour is written instead.
|
750
|
+
# 8 2 Not used
|
751
|
+
# 10 2 Cached magnification factor in page break preview (in percent)
|
752
|
+
# 0 = Default (60%)
|
753
|
+
# 12 2 Cached magnification factor in normal view (in percent)
|
754
|
+
# 0 = Default (100%)
|
755
|
+
# 14 4 Not used
|
756
|
+
flags, _ = work.unpack 'v'
|
757
|
+
worksheet.selected = flags & 0x0200 > 0
|
758
|
+
end
|
713
759
|
def read_workbook
|
714
760
|
worksheet = nil
|
715
761
|
previous_op = nil
|
@@ -718,14 +764,6 @@ class Reader
|
|
718
764
|
case op
|
719
765
|
when @bof, :bof # ● BOF Type = worksheet (➜ 6.8)
|
720
766
|
return
|
721
|
-
worksheet = @workbook.worksheets.find do |worksheet|
|
722
|
-
worksheet.offset == pos
|
723
|
-
end
|
724
|
-
if worksheet
|
725
|
-
read_worksheet worksheet
|
726
|
-
else
|
727
|
-
warn "Unexpected BOF (0x%04x) at position 0x%04x" % [@bof, pos]
|
728
|
-
end
|
729
767
|
when :eof # ● EOF ➜ 6.36
|
730
768
|
postread_workbook
|
731
769
|
return
|
@@ -795,6 +833,8 @@ class Reader
|
|
795
833
|
set_row_address worksheet, work, pos, len
|
796
834
|
when :hlink
|
797
835
|
read_hlink worksheet, work, pos, len
|
836
|
+
when :window2
|
837
|
+
read_window2 worksheet, work, pos, len
|
798
838
|
end
|
799
839
|
previous = op
|
800
840
|
end
|
@@ -95,6 +95,17 @@ class Workbook < Spreadsheet::Writer
|
|
95
95
|
def number_format_index workbook, format
|
96
96
|
@number_formats[workbook][format] || 0
|
97
97
|
end
|
98
|
+
def sanitize_worksheets sheets
|
99
|
+
found_selected = false
|
100
|
+
sheets.each do |sheet|
|
101
|
+
found_selected ||= sheet.selected
|
102
|
+
sheet.format_dates!
|
103
|
+
end
|
104
|
+
unless found_selected
|
105
|
+
sheets.first.selected = true
|
106
|
+
end
|
107
|
+
sheets
|
108
|
+
end
|
98
109
|
def worksheets workbook
|
99
110
|
@worksheets[workbook] ||= workbook.worksheets.collect do |worksheet|
|
100
111
|
Excel::Writer::Worksheet.new self, worksheet
|
@@ -147,6 +158,7 @@ class Workbook < Spreadsheet::Writer
|
|
147
158
|
# Copy unchanged data verbatim, adjust offsets and write new records for
|
148
159
|
# changed data.
|
149
160
|
def write_changes workbook, io
|
161
|
+
sanitize_worksheets workbook.worksheets
|
150
162
|
collect_formats workbook, :existing_document => true
|
151
163
|
reader = workbook.ole
|
152
164
|
sheet_data = {}
|
@@ -370,6 +382,7 @@ class Workbook < Spreadsheet::Writer
|
|
370
382
|
##
|
371
383
|
# Write a new Excel file.
|
372
384
|
def write_from_scratch workbook, io
|
385
|
+
sanitize_worksheets workbook.worksheets
|
373
386
|
collect_formats workbook
|
374
387
|
sheets = worksheets workbook
|
375
388
|
buffer1 = StringIO.new ''
|
@@ -568,6 +581,8 @@ class Workbook < Spreadsheet::Writer
|
|
568
581
|
write_op writer, 0x013d, [1].pack('v')
|
569
582
|
end
|
570
583
|
def write_window1 workbook, writer
|
584
|
+
selected = workbook.worksheets.find do |sheet| sheet.selected end
|
585
|
+
actidx = workbook.worksheets.index selected
|
571
586
|
data = [
|
572
587
|
0x0000, # Horizontal position of the document window
|
573
588
|
# (in twips = 1/20 of a point)
|
@@ -587,7 +602,7 @@ class Workbook < Spreadsheet::Writer
|
|
587
602
|
# 1 = Vertical scroll bar visible
|
588
603
|
# 5 0x0020 0 = Worksheet tab bar hidden
|
589
604
|
# 1 = Worksheet tab bar visible
|
590
|
-
|
605
|
+
actidx, # Index to active (displayed) worksheet
|
591
606
|
0x0000, # Index of first visible tab in the worksheet tab bar
|
592
607
|
0x0001, # Number of selected worksheets
|
593
608
|
# (highlighted in the worksheet tab bar)
|
@@ -158,7 +158,7 @@ class Worksheet
|
|
158
158
|
write_op 0x000c, [count].pack('v')
|
159
159
|
end
|
160
160
|
def write_cell type, row, idx, *args
|
161
|
-
xf_idx = @workbook.xf_index @worksheet.workbook, row.
|
161
|
+
xf_idx = @workbook.xf_index @worksheet.workbook, row.format(idx)
|
162
162
|
data = [
|
163
163
|
row.idx, # Index to row
|
164
164
|
idx, # Index to column
|
@@ -222,8 +222,8 @@ class Worksheet
|
|
222
222
|
end
|
223
223
|
when Formula
|
224
224
|
write_formula row, idx
|
225
|
-
when Date
|
226
|
-
|
225
|
+
when Date, Time
|
226
|
+
write_number row, idx
|
227
227
|
end
|
228
228
|
end
|
229
229
|
write_multiples row, first_idx, multiples if multiples
|
@@ -358,7 +358,7 @@ class Worksheet
|
|
358
358
|
# Write a cell with a Formula. May write an additional String record depending
|
359
359
|
# on the stored result of the Formula.
|
360
360
|
def write_formula row, idx
|
361
|
-
xf_idx = @workbook.xf_index @worksheet.workbook, row.
|
361
|
+
xf_idx = @workbook.xf_index @worksheet.workbook, row.format(idx)
|
362
362
|
cell = row[idx]
|
363
363
|
data1 = [
|
364
364
|
row.idx, # Index to row
|
@@ -562,7 +562,7 @@ class Worksheet
|
|
562
562
|
]
|
563
563
|
# List of nc=lc-fc+1 16-bit indexes to XF records (➜ 6.115)
|
564
564
|
multiples.each_with_index do |blank, cell_idx|
|
565
|
-
xf_idx = @workbook.xf_index @worksheet.workbook, row.
|
565
|
+
xf_idx = @workbook.xf_index @worksheet.workbook, row.format(idx + cell_idx)
|
566
566
|
data.push xf_idx
|
567
567
|
end
|
568
568
|
# Index to last column (lc)
|
@@ -607,7 +607,12 @@ class Worksheet
|
|
607
607
|
# 2 2 Index to column
|
608
608
|
# 4 2 Index to XF record (➜ 6.115)
|
609
609
|
# 6 8 IEEE 754 floating-point value (64-bit double precision)
|
610
|
-
|
610
|
+
value = row[idx]
|
611
|
+
case value
|
612
|
+
when Date, Time
|
613
|
+
value = encode_date(value)
|
614
|
+
end
|
615
|
+
write_cell :number, row, idx, value
|
611
616
|
end
|
612
617
|
def write_op op, *args
|
613
618
|
data = args.join
|
@@ -625,12 +630,7 @@ class Worksheet
|
|
625
630
|
##
|
626
631
|
# Write a cell with a Numeric or Date value.
|
627
632
|
def write_rk row, idx
|
628
|
-
|
629
|
-
case value
|
630
|
-
when Date, DateTime
|
631
|
-
value = encode_date(value)
|
632
|
-
end
|
633
|
-
write_cell :rk, row, idx, encode_rk(value)
|
633
|
+
write_cell :rk, row, idx, encode_rk(row[idx])
|
634
634
|
end
|
635
635
|
def write_row row
|
636
636
|
# Offset Size Contents
|
@@ -766,8 +766,10 @@ class Worksheet
|
|
766
766
|
# 12 2 Cached magnification factor in normal view (in percent)
|
767
767
|
# 0 = Default (100%)
|
768
768
|
# 14 4 Not used
|
769
|
-
flags =
|
770
|
-
|
769
|
+
flags = 0x0536 # Show grid lines, sheet headers, zero values. Automatic
|
770
|
+
# grid line colour, Remove slits if pane freeze is removed,
|
771
|
+
# Sheet is active.
|
772
|
+
if @worksheet.selected
|
771
773
|
flags |= 0x0200
|
772
774
|
end
|
773
775
|
data = [ flags, 0, 0, 0, 0, 0 ].pack binfmt(:window2)
|
data/lib/spreadsheet/format.rb
CHANGED
@@ -158,6 +158,11 @@ module Spreadsheet
|
|
158
158
|
!!/[YMD]/.match(@number_format.to_s)
|
159
159
|
end
|
160
160
|
##
|
161
|
+
# Is the cell formatted as a Date or Time?
|
162
|
+
def date_or_time?
|
163
|
+
!!/[hmsYMD]/.match(@number_format.to_s)
|
164
|
+
end
|
165
|
+
##
|
161
166
|
# Is the cell formatted as a DateTime?
|
162
167
|
def datetime?
|
163
168
|
!!/([YMD].*[HS])|([HS].*[YMD])/.match(@number_format.to_s)
|
data/lib/spreadsheet/link.rb
CHANGED
@@ -18,9 +18,10 @@ module Spreadsheet
|
|
18
18
|
# but if you do, here is where you can find it.
|
19
19
|
class Link < String
|
20
20
|
attr_accessor :target_frame, :url, :dos, :fragment
|
21
|
-
def initialize url='', description=url
|
21
|
+
def initialize url='', description=url, fragment=nil
|
22
22
|
super description
|
23
23
|
@url = url
|
24
|
+
@fragment = fragment
|
24
25
|
end
|
25
26
|
##
|
26
27
|
# The Url with the fragment appended if present.
|
data/lib/spreadsheet/row.rb
CHANGED
data/lib/spreadsheet/workbook.rb
CHANGED
@@ -19,19 +19,18 @@ module Spreadsheet
|
|
19
19
|
# instances may appear at more than one position in #columns.
|
20
20
|
# If you modify a Column directly, your changes will be
|
21
21
|
# reflected in all those positions.
|
22
|
-
# #
|
23
|
-
# all
|
24
|
-
#
|
25
|
-
#
|
26
|
-
# Message if a user tries to print a Workbook that has no
|
27
|
-
# active Worksheets.
|
22
|
+
# #selected :: When a user chooses to print a Workbook, Excel will include
|
23
|
+
# all selected Worksheets. If no Worksheet is selected at
|
24
|
+
# Workbook#write, then the first Worksheet is selected by
|
25
|
+
# default.
|
28
26
|
class Worksheet
|
29
27
|
include Spreadsheet::Encodings
|
30
28
|
include Enumerable
|
31
|
-
attr_accessor :
|
29
|
+
attr_accessor :name, :selected, :workbook
|
32
30
|
attr_reader :rows, :columns
|
33
31
|
def initialize opts={}
|
34
|
-
@
|
32
|
+
@default_format = nil
|
33
|
+
@selected = opts[:selected]
|
35
34
|
@dimensions = [0,0,0,0]
|
36
35
|
@name = opts[:name] || 'Worksheet'
|
37
36
|
@workbook = opts[:workbook]
|
@@ -39,6 +38,14 @@ module Spreadsheet
|
|
39
38
|
@columns = []
|
40
39
|
@links = {}
|
41
40
|
end
|
41
|
+
def active # :nodoc:
|
42
|
+
warn "Worksheet#active is deprecated. Please use Worksheet#selected instead."
|
43
|
+
selected
|
44
|
+
end
|
45
|
+
def active= selected # :nodoc:
|
46
|
+
warn "Worksheet#active= is deprecated. Please use Worksheet#selected= instead."
|
47
|
+
self.selected = selected
|
48
|
+
end
|
42
49
|
##
|
43
50
|
# Add a Format to the Workbook. If you use Row#set_format, you should not
|
44
51
|
# need to use this Method.
|
@@ -134,6 +141,33 @@ module Spreadsheet
|
|
134
141
|
res
|
135
142
|
end
|
136
143
|
##
|
144
|
+
# Formats all Date, DateTime and Time cells with _format_ or the default
|
145
|
+
# formats:
|
146
|
+
# - 'DD.MM.YYYY' for Date
|
147
|
+
# - 'DD.MM.YYYY hh:mm:ss' for DateTime and Time
|
148
|
+
def format_dates! format=nil
|
149
|
+
each do |row|
|
150
|
+
row.each_with_index do |value, idx|
|
151
|
+
unless row.formats[idx] || row.format(idx).date_or_time?
|
152
|
+
numfmt = case value
|
153
|
+
when DateTime, Time
|
154
|
+
format || client('DD.MM.YYYY hh:mm:ss', 'UTF-8')
|
155
|
+
when Date
|
156
|
+
format || client('DD.MM.YYYY', 'UTF-8')
|
157
|
+
end
|
158
|
+
case numfmt
|
159
|
+
when Format
|
160
|
+
row.set_format idx, numfmt
|
161
|
+
when String
|
162
|
+
fmt = row.format(idx).dup
|
163
|
+
fmt.number_format = numfmt
|
164
|
+
row.set_format idx, fmt
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
##
|
137
171
|
# Insert a Row at _idx_ (0-based) containing _cells_
|
138
172
|
def insert_row idx, cells=[]
|
139
173
|
res = @rows.insert idx, Row.new(self, idx, cells)
|
@@ -141,7 +175,6 @@ module Spreadsheet
|
|
141
175
|
res
|
142
176
|
end
|
143
177
|
def inspect
|
144
|
-
"#<#{self.class}:#{object_id} "
|
145
178
|
names = instance_variables
|
146
179
|
names.delete '@rows'
|
147
180
|
variables = names.collect do |name|
|
@@ -183,8 +216,6 @@ module Spreadsheet
|
|
183
216
|
def row_updated idx, row
|
184
217
|
@dimensions = nil
|
185
218
|
@rows[idx] = row
|
186
|
-
format_dates row
|
187
|
-
row
|
188
219
|
end
|
189
220
|
##
|
190
221
|
# Updates the Row at _idx_ with the following arguments.
|
@@ -221,30 +252,6 @@ module Spreadsheet
|
|
221
252
|
row(row)[column] = value
|
222
253
|
end
|
223
254
|
private
|
224
|
-
def format_dates row # :nodoc:
|
225
|
-
## If no format is set in a cell which contains a Date or Time, we will
|
226
|
-
# add a format. At the moment, the number formats correspond to builtin
|
227
|
-
# Excel number-formats. We may need to add a level of abstraction if
|
228
|
-
# additional writers are added to the library.
|
229
|
-
return unless row
|
230
|
-
row.each_with_index do |value, idx|
|
231
|
-
unless row.formats[idx]
|
232
|
-
format = nil
|
233
|
-
case value
|
234
|
-
when Date
|
235
|
-
format = @workbook.formats.find do |fmt| fmt.date? end
|
236
|
-
format ||= Format.new :number_format => client('M/D/YY', 'UTF-8')
|
237
|
-
when DateTime, Time
|
238
|
-
format = @workbook.formats.find do |fmt| fmt.datetime? end
|
239
|
-
format ||= Format.new :number_format => client('M/D/YY h:mm', 'UTF-8')
|
240
|
-
end
|
241
|
-
if format
|
242
|
-
row.formats[idx] = format
|
243
|
-
@workbook.add_format format
|
244
|
-
end
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|
248
255
|
def index_of_first ary # :nodoc:
|
249
256
|
return unless ary
|
250
257
|
ary.index(ary.find do |elm| elm end)
|
data/test/integration.rb
CHANGED
@@ -580,7 +580,7 @@ module Spreadsheet
|
|
580
580
|
sheet = book.worksheet 0
|
581
581
|
assert_equal 11, sheet.row_count
|
582
582
|
assert_equal 12, sheet.column_count
|
583
|
-
useds = [0,0,0,0,0,0,0,
|
583
|
+
useds = [0,0,0,0,0,0,0,0,0,0,0]
|
584
584
|
unuseds = [2,2,1,1,1,2,1,11,1,2,12]
|
585
585
|
sheet.each do |row|
|
586
586
|
assert_equal useds.shift, row.first_used
|
@@ -689,7 +689,7 @@ module Spreadsheet
|
|
689
689
|
sheet = book.worksheet 0
|
690
690
|
assert_equal 11, sheet.row_count
|
691
691
|
assert_equal 12, sheet.column_count
|
692
|
-
useds = [0,0,0,0,0,0,0,
|
692
|
+
useds = [0,0,0,0,0,0,0,0,0,0,0]
|
693
693
|
unuseds = [2,2,1,1,1,2,1,11,1,2,12]
|
694
694
|
sheet.each do |row|
|
695
695
|
assert_equal useds.shift, row.first_used
|
@@ -804,7 +804,7 @@ module Spreadsheet
|
|
804
804
|
sheet1.row(6).set_format 0, fmt
|
805
805
|
sheet1[6,1] = Date.new 2008, 10, 10
|
806
806
|
sheet1[6,2] = Date.new 2008, 10, 12
|
807
|
-
fmt = Format.new :number_format => '
|
807
|
+
fmt = Format.new :number_format => 'D.M.YY'
|
808
808
|
sheet1.row(6).set_format 1, fmt
|
809
809
|
sheet1.update_row 7, nil, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
|
810
810
|
sheet1[8,0] = 0.0005
|
@@ -930,12 +930,12 @@ module Spreadsheet
|
|
930
930
|
assert_equal 1, row[0]
|
931
931
|
assert_equal 1, sheet[6,0]
|
932
932
|
assert_equal 1, sheet.cell(6,0)
|
933
|
-
assert_equal @@iconv.iconv('
|
933
|
+
assert_equal @@iconv.iconv('D.M.YY'), row.format(1).number_format
|
934
934
|
date = Date.new 2008, 10, 10
|
935
935
|
assert_equal date, row[1]
|
936
936
|
assert_equal date, sheet[6,1]
|
937
937
|
assert_equal date, sheet.cell(6,1)
|
938
|
-
assert_equal @@iconv.iconv('
|
938
|
+
assert_equal @@iconv.iconv('DD.MM.YYYY'), row.format(2).number_format
|
939
939
|
date = Date.new 2008, 10, 12
|
940
940
|
assert_equal date, row[2]
|
941
941
|
assert_equal date, sheet[6,2]
|
@@ -1092,7 +1092,7 @@ module Spreadsheet
|
|
1092
1092
|
assert_equal date, row[1]
|
1093
1093
|
assert_equal date, sheet[6,1]
|
1094
1094
|
assert_equal date, sheet.cell(6,1)
|
1095
|
-
assert_equal '
|
1095
|
+
assert_equal 'DD.MM.YYYY', row.format(2).number_format
|
1096
1096
|
date = Date.new 2008, 10, 12
|
1097
1097
|
assert_equal date, row[2]
|
1098
1098
|
assert_equal date, sheet[6,2]
|
@@ -1145,13 +1145,13 @@ module Spreadsheet
|
|
1145
1145
|
book = Spreadsheet.open path
|
1146
1146
|
end
|
1147
1147
|
assert_equal bignum, book.worksheet(0)[0,0]
|
1148
|
-
assert_equal
|
1148
|
+
assert_equal(-bignum, book.worksheet(0)[1,0])
|
1149
1149
|
assert_equal smallnum, book.worksheet(0)[0,1]
|
1150
|
-
assert_equal
|
1150
|
+
assert_equal(-smallnum, book.worksheet(0)[1,1])
|
1151
1151
|
assert_equal bignum - 0.1, book.worksheet(0)[0,2]
|
1152
|
-
assert_equal
|
1152
|
+
assert_equal(-bignum - 0.1, book.worksheet(0)[1,2])
|
1153
1153
|
assert_equal smallnum - 0.1, book.worksheet(0)[0,3]
|
1154
|
-
assert_equal
|
1154
|
+
assert_equal(-smallnum - 0.1, book.worksheet(0)[1,3])
|
1155
1155
|
end
|
1156
1156
|
end
|
1157
1157
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreadsheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.3
|
4
|
+
version: 0.6.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hannes Wyss
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-02-13 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.8.
|
33
|
+
version: 1.8.3
|
34
34
|
version:
|
35
35
|
description: The Spreadsheet Library is designed to read and write Spreadsheet Documents. As of version 0.6.0, only Microsoft Excel compatible spreadsheets are supported. Spreadsheet is a combination/complete rewrite of the Spreadsheet::Excel Library by Daniel J. Berger and the ParseExcel Library by Hannes Wyss. Spreadsheet can read, write and modify Spreadsheet Documents.
|
36
36
|
email:
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
requirements: []
|
125
125
|
|
126
126
|
rubyforge_project: spreadsheet
|
127
|
-
rubygems_version: 1.
|
127
|
+
rubygems_version: 1.3.1
|
128
128
|
signing_key:
|
129
129
|
specification_version: 2
|
130
130
|
summary: The Spreadsheet Library is designed to read and write Spreadsheet Documents
|