surpass 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/LICENSE.txt +110 -0
  2. data/README.txt +21 -111
  3. data/Rakefile +10 -4
  4. data/bin/surpass-info +20 -0
  5. data/lib/formatting.rb +11 -0
  6. data/lib/row.rb +26 -2
  7. data/lib/style.rb +14 -0
  8. data/lib/surpass.rb +2 -2
  9. data/lib/workbook.rb +1 -1
  10. data/lib/worksheet.rb +4 -4
  11. metadata +8 -55
  12. data/examples/big-16mb.rb +0 -25
  13. data/examples/big-random-strings.rb +0 -28
  14. data/examples/blanks.rb +0 -34
  15. data/examples/col_width.rb +0 -16
  16. data/examples/dates.rb +0 -31
  17. data/examples/format.rb +0 -23
  18. data/examples/hello-world.rb +0 -9
  19. data/examples/image.rb +0 -10
  20. data/examples/merged.rb +0 -36
  21. data/examples/merged0.rb +0 -27
  22. data/examples/merged1.rb +0 -99
  23. data/examples/num_formats.rb +0 -55
  24. data/examples/numbers.rb +0 -24
  25. data/examples/outline.rb +0 -110
  26. data/examples/panes.rb +0 -48
  27. data/examples/protection.rb +0 -132
  28. data/examples/python.bmp +0 -0
  29. data/examples/row_styles.rb +0 -16
  30. data/examples/row_styles_empty.rb +0 -15
  31. data/examples/set_cell_and_range_style.rb +0 -12
  32. data/examples/wrapped-text.rb +0 -13
  33. data/examples/write_arrays.rb +0 -16
  34. data/examples/ws_props.rb +0 -80
  35. data/spec/biff_record_spec.rb +0 -268
  36. data/spec/cell_spec.rb +0 -56
  37. data/spec/data/random-strings.txt +0 -10000
  38. data/spec/document_spec.rb +0 -168
  39. data/spec/excel_formula_spec.rb +0 -0
  40. data/spec/formatting_spec.rb +0 -53
  41. data/spec/reference/P-0508-0000507647-3280-5298.xls +0 -0
  42. data/spec/reference/all-cell-styles.bin +0 -0
  43. data/spec/reference/all-number-formats.bin +0 -0
  44. data/spec/reference/all-styles.bin +0 -0
  45. data/spec/reference/mini.xls +0 -0
  46. data/spec/row_spec.rb +0 -19
  47. data/spec/spec_helper.rb +0 -10
  48. data/spec/style_spec.rb +0 -89
  49. data/spec/utilities_spec.rb +0 -57
  50. data/spec/workbook_spec.rb +0 -48
  51. data/spec/worksheet_spec.rb +0 -0
  52. data/stats/cloc.txt +0 -8
  53. data/stats/rcov.txt +0 -0
  54. data/stats/specdoc.txt +0 -158
  55. data/surpass-manual-0-0-3.pdf +0 -0
  56. data/surpass.gemspec +0 -34
  57. data/tasks/excel.rake +0 -6
  58. data/tasks/metrics.rake +0 -42
data/LICENSE.txt ADDED
@@ -0,0 +1,110 @@
1
+ Portions Copyright (c) 2008-9, Ana Nelson
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are
6
+ met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
16
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
19
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+
27
+
28
+
29
+ Surpass is a Ruby port of Python projects xlwt and pyExcelerator, whose
30
+ licenses are below.
31
+
32
+
33
+
34
+ Portions copyright © 2007, Stephen John Machin, Lingfo Pty Ltd
35
+ All rights reserved.
36
+
37
+ Redistribution and use in source and binary forms, with or without
38
+ modification, are permitted provided that the following conditions are met:
39
+
40
+ 1. Redistributions of source code must retain the above copyright notice,
41
+ this list of conditions and the following disclaimer.
42
+
43
+ 2. Redistributions in binary form must reproduce the above copyright notice,
44
+ this list of conditions and the following disclaimer in the documentation
45
+ and/or other materials provided with the distribution.
46
+
47
+ 3. None of the names of Stephen John Machin, Lingfo Pty Ltd and any
48
+ contributors may be used to endorse or promote products derived from this
49
+ software without specific prior written permission.
50
+
51
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
52
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
53
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
54
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
55
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
56
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
57
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
58
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
59
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
60
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
61
+ THE POSSIBILITY OF SUCH DAMAGE.
62
+
63
+
64
+ Copyright (C) 2005 Roman V. Kiseliov
65
+ All rights reserved.
66
+
67
+ Redistribution and use in source and binary forms, with or without
68
+ modification, are permitted provided that the following conditions
69
+ are met:
70
+
71
+ 1. Redistributions of source code must retain the above copyright
72
+ notice, this list of conditions and the following disclaimer.
73
+
74
+ 2. Redistributions in binary form must reproduce the above copyright
75
+ notice, this list of conditions and the following disclaimer in
76
+ the documentation and/or other materials provided with the
77
+ distribution.
78
+
79
+ 3. All advertising materials mentioning features or use of this
80
+ software must display the following acknowledgment:
81
+ "This product includes software developed by
82
+ Roman V. Kiseliov <roman@kiseliov.ru>."
83
+
84
+ 4. Redistributions of any form whatsoever must retain the following
85
+ acknowledgment:
86
+ "This product includes software developed by
87
+ Roman V. Kiseliov <roman@kiseliov.ru>."
88
+
89
+ THIS SOFTWARE IS PROVIDED BY Roman V. Kiseliov ``AS IS'' AND ANY
90
+ EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
91
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
92
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Roman V. Kiseliov OR
93
+ ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
94
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
95
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
96
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
97
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
98
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
99
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
100
+ OF THE POSSIBILITY OF SUCH DAMAGE.
101
+
102
+ Roman V. Kiseliov
103
+ Russia
104
+ Kursk
105
+ Libknecht St., 4
106
+
107
+ +7(0712)56-09-83
108
+
109
+ <roman@kiseliov.ru>
110
+ Subject: pyExcelerator
data/README.txt CHANGED
@@ -1,133 +1,43 @@
1
1
  surpass
2
2
  by Ana Nelson, based on original Python code by Roman V. Kiseliov
3
- http://launchpad.net/surpass
4
3
 
5
- == DESCRIPTION:
6
-
7
- Surpass is writing (and eventually reading) excel workbooks in pure Ruby. Surpass is based on xlwt (and pyExcelerator).
4
+ == WEBSITES:
8
5
 
9
- == REQUIREMENTS:
10
-
11
- Ruby 1.8.6 (C or JRuby)
6
+ Project Home:
7
+ http://surpass.rubyforge.org
12
8
 
13
- == INSTALL:
14
-
15
- bones installation:
16
- sudo rake gem:install
17
-
18
- == Documentation
19
-
20
- See surpass-manual.pdf
21
-
22
- == LICENSE:
9
+ Code Repository:
10
+ bzr branch http://ananelson.com/code/surpass
23
11
 
24
- Portions Copyright (c) 2008-9, Ana Nelson
25
- All rights reserved.
26
-
27
- Redistribution and use in source and binary forms, with or without
28
- modification, are permitted provided that the following conditions are
29
- met:
30
-
31
- * Redistributions of source code must retain the above copyright
32
- notice, this list of conditions and the following disclaimer.
12
+ You'll need to have the Bazaar version control system. This is very easy to install on any platform: http://bazaar-vcs.org
33
13
 
34
- * Redistributions in binary form must reproduce the above copyright
35
- notice, this list of conditions and the following disclaimer in the
36
- documentation and/or other materials provided with the distribution.
14
+ Issue Tracker:
15
+ http://launchpad.net/surpass
37
16
 
38
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
39
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
40
- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
41
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
42
- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
43
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
44
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
45
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
46
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
47
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
48
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
+ Discussions:
18
+ http://groups.google.com/group/ruby-excel
49
19
 
50
20
 
21
+ == DESCRIPTION:
51
22
 
52
- Surpass is a Ruby port of Python projects xlwt and pyExcelerator, whose
53
- licenses are below.
54
-
55
-
56
-
57
- Portions copyright © 2007, Stephen John Machin, Lingfo Pty Ltd
58
- All rights reserved.
59
-
60
- Redistribution and use in source and binary forms, with or without
61
- modification, are permitted provided that the following conditions are met:
62
-
63
- 1. Redistributions of source code must retain the above copyright notice,
64
- this list of conditions and the following disclaimer.
23
+ Surpass is writing (and eventually reading) excel workbooks in pure Ruby. Surpass is based on xlwt (and pyExcelerator).
65
24
 
66
- 2. Redistributions in binary form must reproduce the above copyright notice,
67
- this list of conditions and the following disclaimer in the documentation
68
- and/or other materials provided with the distribution.
25
+ For comprehensive documentation, please refer to the PDF manual which is available from http://surpass.rubyforge.org or in the root directory of the source code repository.
69
26
 
70
- 3. None of the names of Stephen John Machin, Lingfo Pty Ltd and any
71
- contributors may be used to endorse or promote products derived from this
72
- software without specific prior written permission.
27
+ If you like to learn from playing with working examples, then there are plenty in the examples/ and webby/examples directories of the source code.
73
28
 
74
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
75
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
76
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
77
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
78
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
79
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
80
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
81
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
82
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
83
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
84
- THE POSSIBILITY OF SUCH DAMAGE.
85
29
 
30
+ == REQUIREMENTS:
86
31
 
87
- Copyright (C) 2005 Roman V. Kiseliov
88
- All rights reserved.
32
+ Tested with Ruby 1.8.6 (MRI or JRuby)
89
33
 
90
- Redistribution and use in source and binary forms, with or without
91
- modification, are permitted provided that the following conditions
92
- are met:
34
+ This is just standard Ruby, so please feel free to try on other Ruby platforms and let me know how it goes.
93
35
 
94
- 1. Redistributions of source code must retain the above copyright
95
- notice, this list of conditions and the following disclaimer.
36
+ == INSTALL:
96
37
 
97
- 2. Redistributions in binary form must reproduce the above copyright
98
- notice, this list of conditions and the following disclaimer in
99
- the documentation and/or other materials provided with the
100
- distribution.
38
+ sudo gem install surpass
101
39
 
102
- 3. All advertising materials mentioning features or use of this
103
- software must display the following acknowledgment:
104
- "This product includes software developed by
105
- Roman V. Kiseliov <roman@kiseliov.ru>."
106
40
 
107
- 4. Redistributions of any form whatsoever must retain the following
108
- acknowledgment:
109
- "This product includes software developed by
110
- Roman V. Kiseliov <roman@kiseliov.ru>."
41
+ == LICENSE:
111
42
 
112
- THIS SOFTWARE IS PROVIDED BY Roman V. Kiseliov ``AS IS'' AND ANY
113
- EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
114
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
115
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Roman V. Kiseliov OR
116
- ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
117
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
118
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
119
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
120
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
121
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
122
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
123
- OF THE POSSIBILITY OF SUCH DAMAGE.
124
-
125
- Roman V. Kiseliov
126
- Russia
127
- Kursk
128
- Libknecht St., 4
129
-
130
- +7(0712)56-09-83
131
-
132
- <roman@kiseliov.ru>
133
- Subject: pyExcelerator
43
+ Please see LICENSE.txt in this directory.
data/Rakefile CHANGED
@@ -29,7 +29,13 @@ PROJ.ignore_file = '.bzrignore'
29
29
 
30
30
  PROJ.spec.opts << '--color'
31
31
 
32
- PROJ.exclude = %w{.bzr webby}
33
-
34
-
35
- PROJ.rdoc.format = 'darkfish'
32
+ PROJ.exclude = %w{.bzr webby surpass-manual-* examples spec tasks stats .DS_Store}
33
+
34
+ desc "Run all examples (except the big ones) in examples dir."
35
+ task :examples do
36
+ `ls examples/*.rb`.chomp.split("\n").each_with_index do |f, i|
37
+ next if f =~ /big/
38
+ puts "processing #{f}..."
39
+ `ruby #{f}`
40
+ end
41
+ end
data/bin/surpass-info ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "surpass"
5
+ require 'optparse'
6
+
7
+ options = {}
8
+ OptionParser.new do |opts|
9
+ opts.banner = "Usage: surpass-info [options]"
10
+
11
+ opts.on("-c", "--colors", "List available colors") do |v|
12
+ puts Formatting::COLOURS.keys.sort
13
+ end
14
+
15
+ opts.on_tail("-h", "--help", "Show this message") do
16
+ puts opts
17
+ exit
18
+ end
19
+
20
+ end.parse!
data/lib/formatting.rb CHANGED
@@ -218,6 +218,7 @@ class Font
218
218
  end
219
219
  end
220
220
  alias :color= :colour=
221
+ alias :color_index= :colour_index=
221
222
 
222
223
  def to_biff
223
224
  options = PLAIN
@@ -405,6 +406,10 @@ class Borders
405
406
  LINE_TYPE_DIRECTIVES.collect {|k, v| k}
406
407
  end
407
408
 
409
+ def self.line_type_constants
410
+ LINE_TYPE_DIRECTIVES.collect {|k, v| v}
411
+ end
412
+
408
413
  def initialize(hash = {})
409
414
  @left = NO_LINE
410
415
  @right = NO_LINE
@@ -441,6 +446,7 @@ class Borders
441
446
  end
442
447
 
443
448
  raise "no directives given to process_directives" if args.empty? # maybe don't need this, just get thin black border? but for development I want to know if this happens.
449
+ raise "too many directives given to process_directives" if args.size > 2
444
450
 
445
451
  instructions = [THIN, Formatting::COLOURS['black']]
446
452
  args.each do |a|
@@ -454,6 +460,11 @@ class Borders
454
460
  instructions[0] = line_type_directives_hash[a]
455
461
  next
456
462
  end
463
+
464
+ if Borders.line_type_constants.include?(a)
465
+ instructions[0] = a
466
+ next
467
+ end
457
468
 
458
469
  raise "I don't know how to format a border with #{a.inspect}."
459
470
  end
data/lib/row.rb CHANGED
@@ -65,6 +65,7 @@ class Row
65
65
  end
66
66
  end
67
67
 
68
+ # TODO can we get rid of this? Tests pass if it is commented out.
68
69
  def style=(style)
69
70
  adjust_height(style)
70
71
  @xf_index = @parent_wb.styles.add(style)
@@ -102,7 +103,30 @@ class Row
102
103
  end
103
104
 
104
105
  def write(col, label, style)
105
- style = StyleFormat.new(style) if style.is_a?(Hash)
106
+ case style
107
+ when StyleFormat
108
+ # leave it alone
109
+ when Hash
110
+ style = StyleFormat.new(style)
111
+ ### @export "autoformats"
112
+ when TrueClass # Automatically apply a nice numeric format.
113
+ case label
114
+ when DateTime, Time
115
+ style = @parent_wb.styles.default_datetime_style
116
+ when Date
117
+ style = @parent_wb.styles.default_date_style
118
+ when Float
119
+ style = @parent_wb.styles.default_float_style
120
+ else
121
+ style = @parent_wb.styles.default_style
122
+ end
123
+ ### @end
124
+ when NilClass
125
+ style = @parent_wb.styles.default_style
126
+ else
127
+ raise "I don't know how to use this to format a cell #{style.inspect}"
128
+ end
129
+
106
130
  style_index = @parent_wb.styles.add(style)
107
131
 
108
132
  adjust_height(style)
@@ -124,7 +148,7 @@ class Row
124
148
  when ExcelFormula
125
149
  @cells << FormulaCell.new(self, col, style_index, label)
126
150
  else
127
- raise label.class.name
151
+ raise "You are trying to write an object of class #{label.class.name} to a spreadsheet. Please convert this to a supported class such as String."
128
152
  end
129
153
  end
130
154
 
data/lib/style.rb CHANGED
@@ -97,6 +97,20 @@ class StyleCollection
97
97
  @default_format = add_style(@default_style)[0]
98
98
  end
99
99
 
100
+ ### @export "autoformats"
101
+ def default_date_style
102
+ @default_date_style ||= StyleFormat.new(:number_format_string => 'dd-mmm-yyyy')
103
+ end
104
+
105
+ def default_datetime_style
106
+ @default_datetime_style ||= StyleFormat.new(:number_format_string => 'dd-mmm-yyyy hh:mm:ss')
107
+ end
108
+
109
+ def default_float_style
110
+ @default_float_style ||= StyleFormat.new(:number_format_string => '#,##0.00')
111
+ end
112
+ ### @end
113
+
100
114
  def add(style)
101
115
  if style.nil?
102
116
  0x10 # Return the index of the default style.
data/lib/surpass.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Surpass
2
2
 
3
3
  # :stopdoc:
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
6
6
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
7
7
  # :startdoc:
@@ -48,4 +48,4 @@ end # module Surpass
48
48
 
49
49
  Surpass.require_all_libs_relative_to(__FILE__)
50
50
 
51
- require 'date'
51
+ require 'date'
data/lib/workbook.rb CHANGED
@@ -195,7 +195,7 @@ class Workbook
195
195
 
196
196
  def data
197
197
  doc = ExcelDocument.new
198
- doc.data(to_biff)
198
+ doc.data(to_biff).read
199
199
  end
200
200
 
201
201
  def save(filename = nil)
data/lib/worksheet.rb CHANGED
@@ -270,25 +270,25 @@ class Worksheet
270
270
  end
271
271
 
272
272
  # Write the text stored in label in a single cell at (r,c) according to style.
273
- def write(r, c, label = "", style = @parent.styles.default_style)
273
+ def write(r, c, label = "", style = nil)
274
274
  row(r).write(c, label, style)
275
275
  end
276
276
 
277
- def write_array_to_row(array, r, c = 0, style = @parent.styles.default_style)
277
+ def write_array_to_row(array, r, c = 0, style = true)
278
278
  array.each_with_index do |a, i|
279
279
  row(r).write(c + i, a, style)
280
280
  end
281
281
  end
282
282
  alias :rarray :write_array_to_row
283
283
 
284
- def write_array_to_column(array, c, r = 0, style = @parent.styles.default_style)
284
+ def write_array_to_column(array, c, r = 0, style = true)
285
285
  array.each_with_index do |a, i|
286
286
  row(r + i).write(c, a, style)
287
287
  end
288
288
  end
289
289
  alias :carray :write_array_to_column
290
290
 
291
- def write_arrays(array_of_arrays, r = 0, c = 0, style = @parent.styles.default_style)
291
+ def write_arrays(r, c, array_of_arrays, style = true)
292
292
  array_of_arrays.each_with_index do |a, i|
293
293
  raise "not an array of arrays!" unless a.is_a?(Array)
294
294
  write_array_to_row(a, r + i, c, style)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surpass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ana Nelson
@@ -22,46 +22,23 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 2.4.2
24
24
  version:
25
- description: Surpass is writing (and eventually reading) excel workbooks in pure Ruby. Surpass is based on xlwt (and pyExcelerator).
25
+ description: Surpass is writing (and eventually reading) excel workbooks in pure Ruby. Surpass is based on xlwt (and pyExcelerator). For comprehensive documentation, please refer to the PDF manual which is available from http://surpass.rubyforge.org or in the root directory of the source code repository. If you like to learn from playing with working examples, then there are plenty in the examples/ and webby/examples directories of the source code.
26
26
  email: ana@ananelson.com
27
- executables: []
28
-
27
+ executables:
28
+ - surpass-info
29
29
  extensions: []
30
30
 
31
31
  extra_rdoc_files:
32
32
  - History.txt
33
+ - LICENSE.txt
33
34
  - README.txt
34
- - spec/data/random-strings.txt
35
- - stats/cloc.txt
36
- - stats/rcov.txt
37
- - stats/specdoc.txt
35
+ - bin/surpass-info
38
36
  files:
39
37
  - History.txt
38
+ - LICENSE.txt
40
39
  - README.txt
41
40
  - Rakefile
42
- - examples/big-16mb.rb
43
- - examples/big-random-strings.rb
44
- - examples/blanks.rb
45
- - examples/col_width.rb
46
- - examples/dates.rb
47
- - examples/format.rb
48
- - examples/hello-world.rb
49
- - examples/image.rb
50
- - examples/merged.rb
51
- - examples/merged0.rb
52
- - examples/merged1.rb
53
- - examples/num_formats.rb
54
- - examples/numbers.rb
55
- - examples/outline.rb
56
- - examples/panes.rb
57
- - examples/protection.rb
58
- - examples/python.bmp
59
- - examples/row_styles.rb
60
- - examples/row_styles_empty.rb
61
- - examples/set_cell_and_range_style.rb
62
- - examples/wrapped-text.rb
63
- - examples/write_arrays.rb
64
- - examples/ws_props.rb
41
+ - bin/surpass-info
65
42
  - lib/biff_record.rb
66
43
  - lib/bitmap.rb
67
44
  - lib/cell.rb
@@ -77,34 +54,10 @@ files:
77
54
  - lib/utilities.rb
78
55
  - lib/workbook.rb
79
56
  - lib/worksheet.rb
80
- - spec/biff_record_spec.rb
81
- - spec/cell_spec.rb
82
- - spec/data/random-strings.txt
83
- - spec/document_spec.rb
84
- - spec/excel_formula_spec.rb
85
- - spec/formatting_spec.rb
86
- - spec/reference/P-0508-0000507647-3280-5298.xls
87
- - spec/reference/all-cell-styles.bin
88
- - spec/reference/all-number-formats.bin
89
- - spec/reference/all-styles.bin
90
- - spec/reference/mini.xls
91
- - spec/row_spec.rb
92
- - spec/spec_helper.rb
93
- - spec/style_spec.rb
94
- - spec/utilities_spec.rb
95
- - spec/workbook_spec.rb
96
- - spec/worksheet_spec.rb
97
- - stats/cloc.txt
98
- - stats/rcov.txt
99
- - stats/specdoc.txt
100
- - surpass-manual-0-0-3.pdf
101
- - surpass.gemspec
102
57
  - tasks/ann.rake
103
58
  - tasks/bones.rake
104
- - tasks/excel.rake
105
59
  - tasks/gem.rake
106
60
  - tasks/git.rake
107
- - tasks/metrics.rake
108
61
  - tasks/notes.rake
109
62
  - tasks/post_load.rake
110
63
  - tasks/rdoc.rake
data/examples/big-16mb.rb DELETED
@@ -1,25 +0,0 @@
1
- require "rubygems"
2
- require "surpass"
3
-
4
- book = Workbook.new
5
- s = book.add_sheet('0')
6
-
7
- colcount = 200 + 1
8
- rowcount = 6000 + 1
9
-
10
- start = Time.now
11
- puts "starting at #{start.to_s}"
12
-
13
- colcount.times do |c|
14
- rowcount.times do |r|
15
- s.write(r, c, "BIG")
16
- end
17
- end
18
-
19
- t = Time.now - start
20
- puts "time elapsed (writing data to workbook) #{t.to_s}"
21
-
22
- book.save(__FILE__.gsub(/rb$/, "xls"))
23
-
24
- t = Time.now - start
25
- puts "time elapsed (writing workbook to file) #{t.to_s}"
@@ -1,28 +0,0 @@
1
- require "rubygems"
2
- require "surpass"
3
-
4
- strings = File.read("spec/data/random-strings.txt").split("\n")
5
-
6
- book = Workbook.new
7
- s = book.add_sheet('0')
8
-
9
- colcount = 100 + 1
10
- rowcount = 100 + 1
11
-
12
- start = Time.now
13
- puts "starting at #{start.to_s}"
14
-
15
- colcount.times do |c|
16
- rowcount.times do |r|
17
- i = c * rowcount + r
18
- s.write(r, c, strings[i])
19
- end
20
- end
21
-
22
- t = Time.now - start
23
- puts "time elapsed (writing data to workbook) #{t.to_s}"
24
-
25
- book.save(__FILE__.gsub(/rb$/, "xls"))
26
-
27
- t = Time.now - start
28
- puts "time elapsed (writing workbook to file) #{t.to_s}"
data/examples/blanks.rb DELETED
@@ -1,34 +0,0 @@
1
- require "rubygems"
2
- require "surpass"
3
-
4
- font0 = Font.new
5
- font0.name = 'Times New Roman'
6
- font0.struck_out = true
7
- font0.bold = true
8
-
9
- style0 = StyleFormat.new
10
- style0.font = font0
11
-
12
-
13
- book = Workbook.new
14
- ws0 = book.add_sheet('0')
15
-
16
- ws0.write(1, 1, 'Test', style0)
17
-
18
- 0.upto(0x53) do |i|
19
- borders = Borders.new
20
- borders.left = i
21
- borders.right = i
22
- borders.top = i
23
- borders.bottom = i
24
-
25
- style = StyleFormat.new
26
- style.borders = borders
27
-
28
- ws0.write(i, 2, '', style)
29
- ws0.write(i, 3, hex(i), style0)
30
- end
31
-
32
- ws0.write_merge(5, 8, 6, 10, "")
33
-
34
- book.save(__FILE__.gsub(/rb$/, "xls"))
@@ -1,16 +0,0 @@
1
- require "rubygems"
2
- require "surpass"
3
-
4
- book = Workbook.new
5
- ws = book.add_sheet('Hey, Dude')
6
-
7
- (6...80).each do |i|
8
- fnt = Font.new
9
- fnt.height = i*20
10
- style = StyleFormat.new
11
- style.font = fnt
12
- ws.write(1, i, 'Test')
13
- ws.set_column_width(i, i)
14
- end
15
-
16
- book.save(__FILE__.gsub(/rb$/, "xls"))