robust_excel_ole 1.30 → 1.31
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/Changelog +5 -0
- data/README.rdoc +4 -2
- data/benchmarking/reo_example.rb +1 -1
- data/benchmarking/reo_example1.rb +1 -1
- data/benchmarking/reo_example2.rb +1 -1
- data/docs/README_sheet.rdoc +1 -7
- data/examples/introductory_examples/example_open.rb +11 -0
- data/lib/robust_excel_ole.rb +18 -14
- data/lib/robust_excel_ole/cell.rb +1 -1
- data/lib/robust_excel_ole/cygwin.rb +2 -0
- data/lib/robust_excel_ole/general.rb +30 -80
- data/lib/robust_excel_ole/list_object.rb +17 -118
- data/lib/robust_excel_ole/list_row.rb +128 -0
- data/lib/robust_excel_ole/version.rb +1 -1
- data/lib/robust_excel_ole/workbook.rb +47 -14
- data/lib/robust_excel_ole/worksheet.rb +35 -18
- data/lib/spec_helper.rb +1 -1
- data/spec/address_tool_spec.rb +2 -2
- data/spec/base_spec.rb +2 -2
- data/spec/bookstore_spec.rb +1 -1
- data/spec/cell_spec.rb +1 -1
- data/spec/cygwin_spec.rb +1 -1
- data/spec/data/more_data/workbook.xls +0 -0
- data/spec/excel_spec.rb +1 -1
- data/spec/general_spec.rb +34 -7
- data/spec/list_object_spec.rb +85 -20
- data/spec/range_spec.rb +1 -14
- data/spec/spec_helper.rb +1 -1
- data/spec/workbook_spec.rb +1 -1
- data/spec/workbook_specs/workbook_all_spec.rb +8 -28
- data/spec/workbook_specs/workbook_close_spec.rb +1 -1
- data/spec/workbook_specs/workbook_misc_spec.rb +3 -3
- data/spec/workbook_specs/workbook_open_spec.rb +45 -5
- data/spec/workbook_specs/workbook_save_spec.rb +1 -1
- data/spec/workbook_specs/workbook_sheet_spec.rb +1 -1
- data/spec/workbook_specs/workbook_subclass_spec.rb +1 -1
- data/spec/workbook_specs/workbook_unobtr_spec.rb +40 -62
- data/spec/worksheet_spec.rb +33 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 304ee26bf15359eec5e54ac846203b60f3d7419e54779ced816182f76f6e9b46
|
4
|
+
data.tar.gz: 0ea8a4d763d10b286cd29610261b815ca51308cb364483935c5c396fa31e2c67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae94a7357c87e0069e15e279a0eb420df939840192fc2e674f8e3c1890bebdaa7c49d37e0d8a888939f8009109fc7fabf0105e7b76f6b75f168431cb58d2e0e1
|
7
|
+
data.tar.gz: 450ebbad0840bd557c652cc2fa9027dee4a45114a6d3b8ea0065fd5120e9b916ad26ad63a1f97088bb148f1dc07cff7fd9cdf8c9b956e6a0ee2295be4434dec2
|
data/Changelog
CHANGED
data/README.rdoc
CHANGED
@@ -335,11 +335,13 @@ or
|
|
335
335
|
However, this command also starts another pry repl (with another binding). Moreover, local variables in the previous binding are forgotten.
|
336
336
|
|
337
337
|
|
338
|
-
2. The class Win32Ole is being extended such that RobustExcelOle methods can be applied to Win32Ole objects. As mentioned above, the RobustExcelOle objects are wrapper of corresponding WIN32OLE objects.
|
338
|
+
2. The class Win32Ole is being extended such that RobustExcelOle methods can be applied to Win32Ole objects. As mentioned above, the RobustExcelOle objects are wrapper of corresponding WIN32OLE objects. So the RobustExcelOle objects and their wrapped Win32Ole objects are interchangeable. One example would be
|
339
339
|
|
340
340
|
range.ole_range.copy([4,3])
|
341
341
|
|
342
|
-
Likewise it is possible to convert ("type-lift") Win32Ole objects into the corresponding RobustExcelOle object, using
|
342
|
+
Likewise it is possible to convert ("type-lift") Win32Ole objects into the corresponding RobustExcelOle object, using the method +to_reo+. It is a refinement of the class WIN32OLE. So you can write
|
343
|
+
|
344
|
+
using ToReoRefinement
|
343
345
|
|
344
346
|
range = sheet.Names.Item("firstcell").to_reo
|
345
347
|
|
data/benchmarking/reo_example.rb
CHANGED
data/docs/README_sheet.rdoc
CHANGED
@@ -92,17 +92,11 @@ The methods Worksheet#each, Worksheet#each_row and Worksheet#each_column enable
|
|
92
92
|
# do something with column
|
93
93
|
end
|
94
94
|
|
95
|
-
The method Worksheet#values yields
|
95
|
+
The method Worksheet#values yields a 2-dimensional array that contains the values in each row, e.g.
|
96
96
|
|
97
97
|
worksheet.values
|
98
98
|
=> [["foo", "workbook", "sheet1"], ["foo", nil, "foobaaa"], ["matz", "is", "nice"]]
|
99
99
|
|
100
|
-
The method Worksheet#each_rowvalue enables to access the values of each row.
|
101
|
-
|
102
|
-
worksheet.each_rowvalue do |row_values|
|
103
|
-
# do something with the row_values
|
104
|
-
end
|
105
|
-
|
106
100
|
You access a range of a row by giving the number of the row, and optionally, the range of the cell numbers.
|
107
101
|
|
108
102
|
worksheet.row_range(1) # => first row
|
@@ -18,7 +18,18 @@ puts "open a workbook"
|
|
18
18
|
book = Workbook.open(simple_file)
|
19
19
|
puts "make it visible"
|
20
20
|
book.visible = true
|
21
|
+
|
22
|
+
ole_workbook = book.ole_workbook
|
23
|
+
puts "ole_workbook: #{ole_workbook}"
|
24
|
+
sheet = ole_workbook.sheet(1)
|
25
|
+
puts "sheet: #{sheet}"
|
26
|
+
|
27
|
+
using ToReoRefinement
|
21
28
|
puts "book: #{book}"
|
29
|
+
ole_workbook = book.ole_workbook
|
30
|
+
puts "ole_workbook: #{ole_workbook.inspect}"
|
31
|
+
upliftet_ole_workbook = ole_workbook.to_reo
|
32
|
+
puts "upliftet_ole_workbook: #{upliftet_ole_workbook.inspect}"
|
22
33
|
# open a workbook in a new Excel instance
|
23
34
|
puts "open the workbook in a new Excel instance and make it visible"
|
24
35
|
book2 = Workbook.open(another_simple_file, :default => {:excel => :new}, :visible => true)
|
data/lib/robust_excel_ole.rb
CHANGED
@@ -1,21 +1,25 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
1
3
|
if RUBY_PLATFORM =~ /java/
|
2
4
|
require 'jruby-win32ole'
|
3
5
|
else
|
4
6
|
require 'win32ole'
|
5
7
|
end
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
8
|
+
|
9
|
+
require_relative 'robust_excel_ole/general'
|
10
|
+
require_relative 'robust_excel_ole/base'
|
11
|
+
require_relative 'robust_excel_ole/vba_objects'
|
12
|
+
require_relative 'robust_excel_ole/range_owners'
|
13
|
+
require_relative 'robust_excel_ole/address_tool'
|
14
|
+
require_relative 'robust_excel_ole/excel'
|
15
|
+
require_relative 'robust_excel_ole/bookstore'
|
16
|
+
require_relative 'robust_excel_ole/workbook'
|
17
|
+
require_relative 'robust_excel_ole/worksheet'
|
18
|
+
require_relative 'robust_excel_ole/cell'
|
19
|
+
require_relative 'robust_excel_ole/range'
|
20
|
+
require_relative 'robust_excel_ole/list_row'
|
21
|
+
require_relative 'robust_excel_ole/list_object'
|
22
|
+
require_relative 'robust_excel_ole/cygwin' if RUBY_PLATFORM =~ /cygwin/
|
23
|
+
require_relative 'robust_excel_ole/version'
|
20
24
|
|
21
25
|
General.init_reo_for_win32ole
|
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'pathname'
|
3
3
|
|
4
4
|
# @private
|
5
|
+
#class WIN32OLE
|
5
6
|
module ToReoRefinement
|
6
7
|
|
7
8
|
refine WIN32OLE do
|
@@ -61,7 +62,7 @@ end
|
|
61
62
|
module StringRefinement
|
62
63
|
|
63
64
|
refine String do
|
64
|
-
|
65
|
+
|
65
66
|
def / path_part
|
66
67
|
if empty?
|
67
68
|
path_part
|
@@ -70,7 +71,8 @@ module StringRefinement
|
|
70
71
|
self
|
71
72
|
else
|
72
73
|
begin
|
73
|
-
|
74
|
+
path_part = path_part.strip
|
75
|
+
(path_part =~ /^(\/|([A-Z]:\/))/i) ? path_part : (self.chomp('/') + '/' + path_part)
|
74
76
|
rescue TypeError
|
75
77
|
raise TypeError, "Only strings can be parts of paths (given: #{path_part.inspect} of class #{path_part.class})"
|
76
78
|
end
|
@@ -78,6 +80,17 @@ module StringRefinement
|
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
83
|
+
def replace_umlauts
|
84
|
+
word = self.force_encoding('iso-8859-1').encode('utf-8')
|
85
|
+
#word = self.encode("UTF-8")
|
86
|
+
#word = self.encode("UTF-8", "Windows-1252")
|
87
|
+
word.gsub('ä','ae').gsub('Ä','Ae').gsub('ö','oe').gsub('Ö','Oe').gsub('ü','ue').gsub('Ü','Ue')
|
88
|
+
word.gsub('ß','ss').gsub('²','2').gsub('³','3')
|
89
|
+
#word.gsub("\x84",'ae').gsub("\x8E",'Ae').gsub("\x94",'oe').gsub("\x99",'Oe').gsub("\x81",'ue').gsub("\x9A",'Ue')
|
90
|
+
#word.gsub("\xE1",'ss').gsub("\xFD",'2').gsub("\xFC",'3')
|
91
|
+
word
|
92
|
+
end
|
93
|
+
|
81
94
|
# taken from http://apidock.com/rails/ActiveSupport/Inflector/underscore
|
82
95
|
def underscore
|
83
96
|
word = gsub('::', '/')
|
@@ -88,31 +101,6 @@ module StringRefinement
|
|
88
101
|
word
|
89
102
|
end
|
90
103
|
|
91
|
-
def delete_multiple_underscores
|
92
|
-
word = self
|
93
|
-
while word.index('__') do
|
94
|
-
word.gsub!('__','_')
|
95
|
-
end
|
96
|
-
word
|
97
|
-
end
|
98
|
-
|
99
|
-
def replace_umlauts
|
100
|
-
word = self
|
101
|
-
word.gsub!('ä','ae')
|
102
|
-
word.gsub!('Ä','Ae')
|
103
|
-
word.gsub!('ö','oe')
|
104
|
-
word.gsub!('Ö','Oe')
|
105
|
-
word.gsub!('ü','ue')
|
106
|
-
word.gsub!('Ü','Ue')
|
107
|
-
#word.gsub!(/\x84/,'ae')
|
108
|
-
#word.gsub!(/\x8E/,'Ae')
|
109
|
-
#word.gsub!(/\x94/,'oe')
|
110
|
-
#word.gsub!(/\x99/,'Oe')
|
111
|
-
#word.gsub!(/\x81/,'ue')
|
112
|
-
#word.gsub!(/\x9A/,'Ue')
|
113
|
-
word
|
114
|
-
end
|
115
|
-
|
116
104
|
# taken from http://apidock.com/rails/ActiveSupport/Inflector/constantize
|
117
105
|
# File activesupport/lib/active_support/inflector/methods.rb, line 226
|
118
106
|
def constantize # (camel_cased_word)
|
@@ -202,42 +190,10 @@ class Array
|
|
202
190
|
end
|
203
191
|
|
204
192
|
|
205
|
-
=begin
|
206
|
-
# @private
|
207
|
-
module SpaceshipRefinement
|
208
|
-
|
209
|
-
refine Integer do
|
210
|
-
|
211
|
-
alias old_spaceship <=>
|
212
|
-
|
213
|
-
def <=> other
|
214
|
-
# p other
|
215
|
-
if other.is_a? Array
|
216
|
-
self <=> other.first
|
217
|
-
else
|
218
|
-
old_spaceship other
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
refine Array do
|
224
|
-
|
225
|
-
alias old_spaceship <=>
|
226
|
-
|
227
|
-
def <=> other
|
228
|
-
# p other
|
229
|
-
if other.is_a? Integer
|
230
|
-
self <=> [other]
|
231
|
-
else
|
232
|
-
old_spaceship other
|
233
|
-
end
|
234
|
-
end
|
235
|
-
end
|
236
|
-
end
|
237
|
-
=end
|
238
|
-
|
239
193
|
module General
|
240
194
|
|
195
|
+
using ToReoRefinement
|
196
|
+
|
241
197
|
IS_JRUBY_PLATFORM = (RUBY_PLATFORM =~ /java/)
|
242
198
|
::EXPANDPATH_JRUBY_BUG = IS_JRUBY_PLATFORM && true
|
243
199
|
::CONNECT_JRUBY_BUG = IS_JRUBY_PLATFORM && true
|
@@ -249,7 +205,9 @@ module General
|
|
249
205
|
# @private
|
250
206
|
NetworkDrive = Struct.new(:drive_letter, :network_name) do
|
251
207
|
|
252
|
-
def self.
|
208
|
+
def self.get_all_drives
|
209
|
+
network = WIN32OLE.new('WScript.Network')
|
210
|
+
drives = network.enumnetworkdrives
|
253
211
|
ndrives = []
|
254
212
|
count = drives.Count
|
255
213
|
(0..(count - 1)).step(2) do |i|
|
@@ -257,21 +215,14 @@ module General
|
|
257
215
|
end
|
258
216
|
ndrives
|
259
217
|
end
|
260
|
-
|
261
218
|
end
|
262
219
|
|
263
220
|
# @private
|
264
221
|
def hostnameshare2networkpath(filename)
|
265
222
|
return filename unless filename[0,2] == "//"
|
266
|
-
|
267
|
-
|
268
|
-
network_drives = NetworkDrive.get_all(drives)
|
269
|
-
f_c = filename.dup
|
270
|
-
network_drive = network_drives.find do |d|
|
271
|
-
e = f_c.sub!(d.network_name,d.drive_letter)
|
272
|
-
return e if e
|
223
|
+
NetworkDrive.get_all_drives.inject(filename) do |fn_modified, d|
|
224
|
+
fn_modified.sub(/#{(Regexp.escape(d.network_name))}/i,d.drive_letter)
|
273
225
|
end
|
274
|
-
filename
|
275
226
|
end
|
276
227
|
|
277
228
|
# @private
|
@@ -301,10 +252,12 @@ module General
|
|
301
252
|
path
|
302
253
|
end
|
303
254
|
|
255
|
+
# @private
|
304
256
|
def change_current_binding(current_object)
|
305
257
|
Pry.change_current_binding(current_object)
|
306
258
|
end
|
307
259
|
|
260
|
+
# @private
|
308
261
|
def class2method
|
309
262
|
[{RobustExcelOle::Excel => :Hwnd},
|
310
263
|
{RobustExcelOle::Workbook => :FullName},
|
@@ -313,18 +266,15 @@ module General
|
|
313
266
|
{RobustExcelOle::ListObject => :ListRows}]
|
314
267
|
end
|
315
268
|
|
316
|
-
|
317
|
-
|
269
|
+
# @private
|
318
270
|
# enable RobustExcelOle methods to Win32Ole objects
|
319
271
|
def init_reo_for_win32ole
|
320
|
-
exclude_list = [:each, :each_with_index, :inspect, :Calculation=]
|
321
272
|
class2method.each do |element|
|
322
273
|
classname = element.first.first
|
323
|
-
classname.instance_methods(false).
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
end
|
274
|
+
meths = (classname.instance_methods(false) - WIN32OLE.instance_methods(false) - Object.methods - Enumerable.instance_methods(false) - [:Calculation=])
|
275
|
+
meths.each do |inst_method|
|
276
|
+
WIN32OLE.send(:define_method, inst_method) do |*args, &blk|
|
277
|
+
self.to_reo.send(inst_method, *args, &blk)
|
328
278
|
end
|
329
279
|
end
|
330
280
|
end
|
@@ -332,7 +282,7 @@ module General
|
|
332
282
|
end
|
333
283
|
|
334
284
|
module_function :absolute_path, :canonize, :normalize, :change_current_binding, :class2method,
|
335
|
-
:init_reo_for_win32ole, :hostnameshare2networkpath
|
285
|
+
:init_reo_for_win32ole, :hostnameshare2networkpath, :test
|
336
286
|
|
337
287
|
end
|
338
288
|
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module RobustExcelOle
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
using ToReoRefinement
|
6
|
+
using FindAllIndicesRefinement
|
7
|
+
|
8
8
|
# This class essentially wraps a Win32Ole ListObject.
|
9
9
|
# You can apply all VBA methods (starting with a capital letter)
|
10
10
|
# that you would apply for a ListObject.
|
@@ -16,10 +16,6 @@ module RobustExcelOle
|
|
16
16
|
|
17
17
|
alias ole_object ole_table
|
18
18
|
|
19
|
-
using FindAllIndicesRefinement
|
20
|
-
using StringRefinement
|
21
|
-
using ToReoRefinement
|
22
|
-
|
23
19
|
# constructs a list object (or table).
|
24
20
|
# @param [Variable] worksheet_or_listobject a worksheet or a list object
|
25
21
|
# @param [Variable] table_name_or_number a table name or table number
|
@@ -63,121 +59,25 @@ module RobustExcelOle
|
|
63
59
|
end
|
64
60
|
end
|
65
61
|
|
66
|
-
|
67
62
|
ole_table = @ole_table
|
63
|
+
|
68
64
|
@row_class = Class.new(ListRow) do
|
69
65
|
|
70
66
|
@@ole_table = ole_table
|
71
67
|
|
72
|
-
def
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
# returns the value of the cell with given column name or number
|
77
|
-
# @param [Variant] column number or column name
|
78
|
-
# @return [Variant] value of the cell
|
79
|
-
def [] column_number_or_name
|
80
|
-
begin
|
81
|
-
ole_cell = @@ole_table.Application.Intersect(
|
82
|
-
@ole_listrow.Range, @@ole_table.ListColumns.Item(column_number_or_name).Range)
|
83
|
-
ole_cell.Value
|
84
|
-
rescue WIN32OLERuntimeError
|
85
|
-
raise TableRowError, "could not determine the value at column #{column_number_or_name}"
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
def []=(column_number_or_name, value)
|
91
|
-
begin
|
92
|
-
ole_cell = @@ole_table.Application.Intersect(
|
93
|
-
@ole_listrow.Range, @@ole_table.ListColumns.Item(column_number_or_name).Range)
|
94
|
-
ole_cell.Value = value
|
95
|
-
rescue WIN32OLERuntimeError
|
96
|
-
raise TableRowError, "could not assign value #{value.inspect} to cell at column #{column_number_or_name}"
|
97
|
-
end
|
68
|
+
def ole_table
|
69
|
+
@@ole_table
|
98
70
|
end
|
71
|
+
|
72
|
+
end
|
99
73
|
|
100
|
-
|
101
|
-
# @return [Array] values of the row
|
102
|
-
def values
|
103
|
-
begin
|
104
|
-
@ole_listrow.Range.Value.first
|
105
|
-
rescue WIN32OLERuntimeError
|
106
|
-
raise TableError, "could not read values"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
# sets the values of the row
|
111
|
-
# @param [Array] values of the row
|
112
|
-
def set_values values
|
113
|
-
begin
|
114
|
-
updated_values = self.values
|
115
|
-
updated_values[0,values.length] = values
|
116
|
-
@ole_listrow.Range.Value = [updated_values]
|
117
|
-
values
|
118
|
-
rescue WIN32OLERuntimeError
|
119
|
-
raise TableError, "could not set values #{values.inspect}"
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
# deletes the values of the row
|
124
|
-
def delete_values
|
125
|
-
begin
|
126
|
-
@ole_listrow.Range.Value = [[].fill(nil,0..(@@ole_table.ListColumns.Count)-1)]
|
127
|
-
nil
|
128
|
-
rescue WIN32OLERuntimeError
|
129
|
-
raise TableError, "could not delete values"
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
def method_missing(name, *args)
|
134
|
-
name_str = name.to_s
|
135
|
-
core_name = name_str[-1]!='=' ? name_str : name_str[0..-2]
|
136
|
-
column_names = @@ole_table.HeaderRowRange.Value.first
|
137
|
-
column_name = column_names.find do |c|
|
138
|
-
c == core_name ||
|
139
|
-
c.gsub(/\W/,'') == core_name ||
|
140
|
-
c.replace_umlauts == core_name ||
|
141
|
-
c.gsub(/\W/,'').replace_umlauts == core_name ||
|
142
|
-
c.gsub(/\W/,'').replace_umlauts.underscore.gsub(/[^[\w\d]]/, '_').delete_multiple_underscores == core_name
|
143
|
-
end
|
144
|
-
if column_name
|
145
|
-
method_name = core_name.gsub(/\W/,'') + (name_str[-1]!='=' ? "" : "=")
|
146
|
-
define_and_call_method(column_name,method_name,*args)
|
147
|
-
else
|
148
|
-
super(name, *args)
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
private
|
153
|
-
|
154
|
-
def define_and_call_method(column_name,method_name,*args)
|
155
|
-
ole_cell = @@ole_table.Application.Intersect(
|
156
|
-
@ole_listrow.Range, @@ole_table.ListColumns.Item(column_name).Range)
|
157
|
-
define_getting_setting_method(ole_cell,method_name)
|
158
|
-
self.send(method_name, *args)
|
159
|
-
end
|
160
|
-
|
161
|
-
def define_getting_setting_method(ole_cell,name)
|
162
|
-
if name[-1] != '='
|
163
|
-
self.class.define_method(name) do
|
164
|
-
ole_cell.Value
|
165
|
-
end
|
166
|
-
else
|
167
|
-
self.class.define_method(name) do |value|
|
168
|
-
ole_cell.Value = value
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
# accesses a table row object
|
175
|
-
# @param [Integer] a row number (>= 1)
|
176
|
-
# @return [ListRow] a object of dynamically constructed class with superclass ListRow
|
177
|
-
def [] row_number
|
178
|
-
@row_class.new(row_number)
|
179
|
-
end
|
74
|
+
end
|
180
75
|
|
76
|
+
# accesses a table row object
|
77
|
+
# @param [Integer] a row number (>= 1)
|
78
|
+
# @return [ListRow] a object of dynamically constructed class with superclass ListRow
|
79
|
+
def [] row_number
|
80
|
+
@row_class.new(row_number)
|
181
81
|
end
|
182
82
|
|
183
83
|
# @return [Array] a list of column names
|
@@ -217,7 +117,7 @@ module RobustExcelOle
|
|
217
117
|
|
218
118
|
# deletes a row
|
219
119
|
# @param [Integer] position of the old row
|
220
|
-
def delete_row(row_number)
|
120
|
+
def delete_row(row_number) # :nodoc: #
|
221
121
|
begin
|
222
122
|
@ole_table.ListRows.Item(row_number).Delete
|
223
123
|
rescue WIN32OLERuntimeError
|
@@ -227,7 +127,7 @@ module RobustExcelOle
|
|
227
127
|
|
228
128
|
# deletes a column
|
229
129
|
# @param [Variant] column number or column name
|
230
|
-
def delete_column(column_number_or_name)
|
130
|
+
def delete_column(column_number_or_name) # :nodoc: #
|
231
131
|
begin
|
232
132
|
@ole_table.ListColumns.Item(column_number_or_name).Delete
|
233
133
|
rescue WIN32OLERuntimeError
|
@@ -261,7 +161,7 @@ module RobustExcelOle
|
|
261
161
|
# renames a row
|
262
162
|
# @param [String] previous name or number of the column
|
263
163
|
# @param [String] new name of the column
|
264
|
-
def rename_column(name_or_number, new_name)
|
164
|
+
def rename_column(name_or_number, new_name) # :nodoc: #
|
265
165
|
begin
|
266
166
|
@ole_table.ListColumns.Item(name_or_number).Name = new_name
|
267
167
|
rescue
|
@@ -430,6 +330,5 @@ module RobustExcelOle
|
|
430
330
|
end
|
431
331
|
|
432
332
|
Table = ListObject
|
433
|
-
TableRow = ListRow
|
434
333
|
|
435
334
|
end
|