robust_excel_ole 1.21 → 1.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7598173082d025a168f3c4e8021eb41c97fb1af36943e35cf2a812fcc0f39672
4
- data.tar.gz: 2e1e0585da1b1369d323b218b0817f23679b71f99f637a269a6abf14673df615
3
+ metadata.gz: f5739475bb50983be2c17b084b939ec1143d9508f280dfd8bf80445d5fbce521
4
+ data.tar.gz: 1ecdceba6d53cf8a231d81425ca2c8f9b02a6fff2f6e2ad4aa90813b1223febf
5
5
  SHA512:
6
- metadata.gz: '09581d754af617dcbe58149087d78c0281e7aa1e6d5feb27f4b58a0b08a0cc5967d15398d85952174143a2e867133b2d1dbf352fd0656bc7488183c7edca94ab'
7
- data.tar.gz: bc6c1bed4f9b3370a376b875fa5a4f64b690ef6df6da70efde30a5caa49447b32b28ba09864adcb4c0ca9ea861ddeb28b5af851e30db826e749c6c97cc0153de
6
+ metadata.gz: a4b326afc9230578f4f10bbbd4b2bb12d0536b3104ed0cc897b96a7ed3afe8ee6016181aa0603c8c9f260fa1966b19cd5b9ab07af5dda8312f9b7b363ee7ac7a
7
+ data.tar.gz: 06b76a2ecbab24b208d449d858329eb997e6375b2e5533c2ee0525fc1316ca249aa4594a9feb70525a9f492ba92153fdd9264caa23a6ec3c1af02547debab2d8
data/Changelog CHANGED
@@ -1,6 +1,12 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [1.22] 2020-10-08
5
+
6
+ ## [1.21] 2020-05-08
7
+
8
+ ### Added
9
+ - Range#rows, columns
4
10
 
5
11
  ## [1.20] 2020-23-07
6
12
 
@@ -27,7 +27,6 @@ RobustExcelOle supports
27
27
  - availability of all VBA methods
28
28
  - availability of the Excel constants (in form if Ruby constants: Excel constant.capitalize)
29
29
  - all standard Excel file formats (.xlsx, .xls, .xlsm)
30
- - list objects
31
30
  - reopening workbooks after closing them
32
31
  - unobtrusively opening workbooks, i.e. opening and processing workbooks
33
32
  while preserving their status, e.g. saved, readonly
@@ -318,139 +317,6 @@ and set another value to that range.
318
317
 
319
318
  For more details about reading and writing contents of cells and ranges see {README_ranges}[https://github.com/Thomas008/robust_excel_ole/blob/master/docs/README_ranges.rdoc]
320
319
 
321
- === List Objects
322
-
323
- === Creating List Objects
324
-
325
- We can define a list object (or table) from scratch.
326
-
327
- table = ListObject.new(worksheet, "table 1", [1,1], 3,["Person","AmountSales"])
328
-
329
- This command creates a list object in worksheet named "table 1", with upper left corner at position [1,1] (first cell), with 3 rows and the columns "Person" and "Amoun%tSales".
330
-
331
- Likewise we can get a RobustExcelOle list object with help of an existing WIN32OlE list object.
332
-
333
- ole_listobject = worksheet.ListObjects.Item("Table 1")
334
- table = ListObject.new(ole_listobject)
335
-
336
- or
337
-
338
- table = ole_listobject.to_reo
339
-
340
- Now we have a RobustExcelOle ListObject that wraps a WIN32OLE ListObject. So we can send any WIN32OLE (VBA) method to it. See
341
- https://docs.microsoft.com/en-us/office/vba/api/excel.listobject#methods.
342
-
343
- A row in this table can be accessed with help of #[], e.g.
344
-
345
- row1 = table[1]
346
-
347
- === Reading and setting values
348
-
349
- Now we can set and get the value of a cell of the table with help of methods that are equal to or are underscored variants of the column names, e.g.
350
-
351
- row1.AmountSales = 40
352
-
353
- or
354
-
355
- row1.amount_sales = 40
356
-
357
- and
358
-
359
- row1.AmountSales
360
- # => 40
361
-
362
- or
363
-
364
- row1.amount_sales
365
- # => 40
366
-
367
- Special characters in the colare being ignored.
368
-
369
- We can also read and set values in a whole row, e.g.
370
-
371
- table.row_values(1)
372
- # => ["John", 40]
373
-
374
- or
375
-
376
- table[1].values
377
- # => ["John", 40]
378
-
379
- and
380
-
381
- table.set_row_values(1, ["Herbert", 80])
382
- # => ["Herbert", 80]
383
-
384
- or
385
-
386
- table[1].set_values(["Herbert", 80])
387
-
388
- If the number of given values is less than the number of cells in the row, only the first values are written. The remaining values keep their value.
389
-
390
- Similarly, we can read and set the values in a whole column, e.g.
391
-
392
- table.column_values("Person")
393
- # => ["John", "Peter"]
394
-
395
- and
396
-
397
- table.set_column_values(1, ["Herbert","Paul"])
398
-
399
- The column names we can get with help of
400
-
401
- table.column_names
402
-
403
- A column can be renamed.
404
-
405
- table.rename_column("Person", "Enterprise")
406
-
407
- or
408
-
409
- table.rename_column(1, "Enterprise")
410
-
411
- === Adding and Deleting rows and columns
412
-
413
- We can add rows and columns, supplying optionally their name, the position and contents.
414
-
415
- table.add_column("column_name")
416
- table.add_column("column_name", 3)
417
- table.add_column("column_name", 3, ["John", "Paul"])
418
-
419
- table.add_row(3)
420
- table.add_row(3, ["John", 40, 2, 2004])
421
-
422
- Deleting columns and rows is done by
423
-
424
- table.delete_column("column_name")
425
- table.delete_row(3)
426
-
427
- We can delete only the contents of a column
428
-
429
- table.delete_column_values("column_name")
430
-
431
- Similarly can delete only the contents of a row.
432
-
433
- table.delete_row_values(2)
434
-
435
- or
436
-
437
- table[2].delete_values
438
-
439
- Finally we can delete empty rows and columns.
440
-
441
- table.delete_empty_rows
442
- table.delete_empty_columns
443
-
444
- === Finding values and sorting
445
-
446
- You can find all cells containing a given value, e.g.
447
-
448
- table.find_value(value)
449
- #=> [#<Cell: (5,8)>#, #<Cell: (9,6)>#]
450
-
451
- You can sort a table according to a given column and sort order, e.g.
452
-
453
- table.sort("Person", :ascending)
454
320
 
455
321
  === More things
456
322
 
data/bin/jreo CHANGED
@@ -2,23 +2,26 @@
2
2
  # -*- jruby -*-
3
3
 
4
4
  require 'pry'
5
- require 'robust_excel_ole'
5
+ require '../robust_excel_ole/lib/robust_excel_ole'
6
6
 
7
7
  include REO
8
8
  include General
9
9
 
10
- puts 'REO console started'
11
- puts
12
-
13
10
  # some pry configuration
14
11
  Pry.config.windows_console_warning = false
15
- Pry.config.history.should_save = true
12
+ #Pry.config.history_save = true
16
13
  Pry.config.color = false
17
14
  #Pry.editor = 'notepad' # 'subl', 'vi'
18
15
  #Pry.config.prompt =
19
- # [
20
- # ->(_obj, _nest_level, _) { ">> " },
21
- # ->(*) { " " }
22
- # ]
16
+ #[
17
+ #->(_obj, _nest_level, _) { ">> " },
18
+ #->(*) { " " }
19
+ #]
23
20
 
24
- pry
21
+ hooks = Pry::Hooks.new
22
+
23
+ hooks.add_hook :when_started, :hook12 do
24
+ puts 'REO console started'
25
+ puts
26
+ end
27
+ Pry.start(nil, hooks: hooks)
data/jreo.bat CHANGED
@@ -1,3 +1,3 @@
1
1
  @echo off
2
2
 
3
- jirb -f -r ./lib/robust_excel_ole -r ./lib/jreo_console.rb
3
+ jruby lib/reo_console.rb
@@ -32,7 +32,7 @@ module RobustExcelOle
32
32
  def fetch(filename, options = { :prefer_writable => true })
33
33
  return nil unless filename
34
34
  filename = General.absolute_path(filename)
35
- filename_key = General.canonize(filename)
35
+ filename_key = General.canonize(filename).downcase
36
36
  weakref_books = @filename2books[filename_key]
37
37
  return nil if weakref_books.nil? || weakref_books.empty?
38
38
 
@@ -70,9 +70,9 @@ module RobustExcelOle
70
70
  # stores a workbook
71
71
  # @param [Workbook] book a given book
72
72
  def store(book)
73
- filename_key = General.canonize(book.filename)
73
+ filename_key = General.canonize(book.filename).downcase
74
74
  if book.stored_filename
75
- old_filename_key = General.canonize(book.stored_filename)
75
+ old_filename_key = General.canonize(book.stored_filename).downcase
76
76
  # deletes the weak reference to the book
77
77
  @filename2books[old_filename_key].delete(book)
78
78
  end
@@ -20,18 +20,19 @@ module RobustExcelOle
20
20
  self.Value = value
21
21
  end
22
22
 
23
+ # @private
23
24
  def ole_cell
24
25
  @ole_range = @ole_range.MergeArea.Item(1,1) if @ole_range.MergeCells
25
26
  end
26
27
 
27
28
  # @private
28
29
  def to_s
29
- @ole_range.Name.to_s
30
+ "#<Cell:" + " (#{@ole_range.Row},#{@ole_range.Column})" + ">"
30
31
  end
31
32
 
32
33
  # @private
33
- def inspect
34
- "#<Cell:" + " (#{@ole_range.Row},#{@ole_range.Column})" + ">#"
34
+ def inspect
35
+ self.to_s[0..-2] + " #{@ole_range.Parent.Name}" + ">"
35
36
  end
36
37
 
37
38
  private
@@ -701,7 +701,7 @@ module RobustExcelOle
701
701
  # @param [String] name the name of the range
702
702
  # @param [Variant] value the contents of the range
703
703
  def []=(name, value)
704
- set_namevalue_glob(name, value, :color => 42)
704
+ set_namevalue_glob(name, value)
705
705
  end
706
706
 
707
707
  # @private
@@ -10,13 +10,14 @@ module General
10
10
  ::CONNECT_EXCEL_JRUBY_BUG = IS_JRUBY_PLATFORM && true
11
11
  ::RANGES_JRUBY_BUG = IS_JRUBY_PLATFORM && true
12
12
 
13
+ @private
13
14
  NetworkDrive = Struct.new(:drive_letter, :network_name) do
14
15
 
15
16
  def self.get_all(drives)
16
17
  ndrives = []
17
18
  count = drives.Count
18
19
  (0..(count - 1)).step(2) do |i|
19
- ndrives << NetworkDrive.new( drives.Item(i), drives.Item(i + 1))
20
+ ndrives << NetworkDrive.new( drives.Item(i), drives.Item(i + 1).tr('\\','/'))
20
21
  end
21
22
  ndrives
22
23
  end
@@ -24,23 +25,22 @@ module General
24
25
  end
25
26
 
26
27
  @private
27
- def network2hostnamesharepath(filename)
28
+ def hostnameshare2networkpath(filename)
29
+ return filename unless filename[0,2] == "//"
28
30
  network = WIN32OLE.new('WScript.Network')
29
31
  drives = network.enumnetworkdrives
30
- drive_letter, filename_after_drive_letter = filename.split(':')
31
- drive_letter = normalize_drive_letter(drive_letter)
32
32
  network_drives = NetworkDrive.get_all(drives)
33
- network_drive = network_drives.find{ |d| d.drive_letter == drive_letter }
34
- return filename unless network_drive
35
- return network_drive.network_name + filename_after_drive_letter
36
- end
33
+ f_c = filename.dup
34
+ network_drive = network_drives.find do |d|
35
+ e = f_c.sub!(d.network_name,d.drive_letter)
36
+ return e if e
37
+ end
38
+ filename
39
+ end
37
40
 
38
- def self.normalize_drive_letter(drive)
39
- drive.upcase.end_with?(':') ? drive : "#{drive}:"
40
- end
41
-
42
41
  # @private
43
- def absolute_path(file)
42
+ def absolute_path(file)
43
+ return file if file[0,2] == "//"
44
44
  file[0,2] = './' if ::EXPANDPATH_JRUBY_BUG && file =~ /[A-Z]:[^\/]/
45
45
  file = File.expand_path(file)
46
46
  file = RobustExcelOle::Cygwin.cygpath('-w', file) if RUBY_PLATFORM =~ /cygwin/
@@ -50,8 +50,8 @@ module General
50
50
  # @private
51
51
  def canonize(filename)
52
52
  raise TypeREOError, "No string given to canonize, but #{filename.inspect}" unless filename.is_a?(String)
53
- filename = network2hostnamesharepath(filename)
54
- normalize(filename).downcase if filename
53
+ filename = hostnameshare2networkpath(filename)
54
+ normalize(filename) if filename
55
55
  end
56
56
 
57
57
  # @private
@@ -20,8 +20,14 @@ module RobustExcelOle
20
20
  def initialize(win32_range, worksheet = nil)
21
21
  @ole_range = win32_range
22
22
  @worksheet = worksheet ? worksheet.to_reo : worksheet_class.new(self.Parent)
23
- address_r1c1 = @ole_range.AddressLocal(true,true,XlR1C1)
24
- @rows, @columns = address_tool.as_integer_ranges(address_r1c1)
23
+ end
24
+
25
+ def rows
26
+ @rows ||= (1..@ole_range.Rows.Count)
27
+ end
28
+
29
+ def columns
30
+ @columns ||= (1..@ole_range.Columns.Count)
25
31
  end
26
32
 
27
33
  def each
@@ -49,7 +55,6 @@ module RobustExcelOle
49
55
  # @params [Range] a range
50
56
  # @returns [Array] the values
51
57
  def values(range = nil)
52
- #result = map { |x| x.Value }.flatten
53
58
  result_unflatten = if !::RANGES_JRUBY_BUG
54
59
  map { |x| x.v }
55
60
  else
@@ -71,9 +76,9 @@ module RobustExcelOle
71
76
  self.Value
72
77
  else
73
78
  values = []
74
- @rows.each do |r|
79
+ rows.each do |r|
75
80
  values_col = []
76
- @columns.each{ |c| values_col << worksheet.Cells(r,c).Value}
81
+ columns.each{ |c| values_col << worksheet.Cells(r,c).Value}
77
82
  values << values_col
78
83
  end
79
84
  values
@@ -89,8 +94,8 @@ module RobustExcelOle
89
94
  if !::RANGES_JRUBY_BUG
90
95
  ole_range.Value = value
91
96
  else
92
- @rows.each_with_index do |r,i|
93
- @columns.each_with_index do |c,j|
97
+ rows.each_with_index do |r,i|
98
+ columns.each_with_index do |c,j|
94
99
  ole_range.Cells(i+1,j+1).Value = (value.respond_to?(:first) ? value[i][j] : value)
95
100
  end
96
101
  end
@@ -108,44 +113,29 @@ module RobustExcelOle
108
113
  # @params [Address or Address-Array] address or upper left position of the destination range
109
114
  # @options [Worksheet] the destination worksheet
110
115
  # @options [Hash] options: :transpose, :values_only
111
- def copy(dest_address1, sheet_or_dest_address2 = :__not_provided, options_or_sheet = :__not_provided, not_provided_or_options = :__not_provided)
112
- begin
113
- dest_address = if sheet_or_dest_address2.is_a?(Object::Range) or sheet_or_dest_address2.is_a?(Integer)
114
- [dest_address1,sheet_or_dest_address2]
115
- else
116
- dest_address1
117
- end
118
- dest_sheet = if sheet_or_dest_address2.is_a?(Worksheet) or sheet_or_dest_address2.is_a?(WIN32OLE)
119
- sheet_or_dest_address2.to_reo
120
- else
121
- if options_or_sheet.is_a?(Worksheet) or options_or_sheet.is_a?(WIN32OLE)
122
- options_or_sheet.to_reo
123
- else
124
- @worksheet
125
- end
126
- end
127
- options = if options_or_sheet.is_a?(Hash)
128
- options_or_sheet
129
- else
130
- if not_provided_or_options.is_a?(Hash)
131
- not_provided_or_options
132
- else
133
- { }
134
- end
116
+ def copy(dest_address, *remaining_args)
117
+ dest_sheet = @worksheet
118
+ options = { }
119
+ remaining_args.each do |arg|
120
+ case arg
121
+ when Object::Range, Integer then dest_address = [dest_address,arg]
122
+ when Worksheet, WIN32OLE then dest_sheet = arg.to_reo
123
+ when Hash then options = arg
124
+ else raise RangeNotCopied, "cannot copy range: argument error: #{remaining_args.inspect}"
135
125
  end
126
+ end
127
+ begin
136
128
  rows, columns = address_tool.as_integer_ranges(dest_address)
137
129
  dest_address_is_position = (rows.min == rows.max && columns.min == columns.max)
138
130
  dest_range_address = if (not dest_address_is_position)
139
- [rows.min..rows.max,columns.min..columns.max]
131
+ [rows.min..rows.max,columns.min..columns.max]
132
+ else
133
+ if (not options[:transpose])
134
+ [rows.min..rows.min+self.Rows.Count-1, columns.min..columns.min+self.Columns.Count-1]
140
135
  else
141
- if (not options[:transpose])
142
- [rows.min..rows.min+self.Rows.Count-1,
143
- columns.min..columns.min+self.Columns.Count-1]
144
- else
145
- [rows.min..rows.min+self.Columns.Count-1,
146
- columns.min..columns.min+self.Rows.Count-1]
147
- end
136
+ [rows.min..rows.min+self.Columns.Count-1, columns.min..columns.min+self.Rows.Count-1]
148
137
  end
138
+ end
149
139
  dest_range = dest_sheet.range(dest_range_address)
150
140
  if options[:values_only]
151
141
  dest_range.v = options[:transpose] ? self.v.transpose : self.v
@@ -160,8 +150,8 @@ module RobustExcelOle
160
150
  else
161
151
  if options[:transpose]
162
152
  added_sheet = @worksheet.workbook.add_sheet
163
- self.copy_special(dest_address, added_sheet, :transpose => true)
164
- added_sheet.range(dest_range_address).copy_special(dest_address,dest_sheet)
153
+ self.copy(dest_address, added_sheet, :transpose => true)
154
+ added_sheet.range(dest_range_address).copy(dest_address,dest_sheet)
165
155
  @worksheet.workbook.excel.with_displayalerts(false) {added_sheet.Delete}
166
156
  else
167
157
  self.Copy
@@ -169,63 +159,12 @@ module RobustExcelOle
169
159
  end
170
160
  end
171
161
  end
162
+ dest_range
172
163
  rescue WIN32OLERuntimeError, Java::OrgRacobCom::ComFailException => msg
173
164
  raise RangeNotCopied, 'cannot copy range'
174
165
  end
175
166
  end
176
167
 
177
- # becomes copy
178
- # copies a range
179
- # @params [Address or Address-Array] address or upper left position of the destination range
180
- # @options [Worksheet] the destination worksheet
181
- # @options [Hash] options: :transpose, :values_only
182
- def copy_special(dest_address, dest_sheet = :__not_provided, options = { })
183
- rows, columns = address_tool.as_integer_ranges(dest_address)
184
- dest_sheet = @worksheet if dest_sheet == :__not_provided
185
- dest_address_is_position = (rows.min == rows.max && @columns.min == @columns.max)
186
- dest_range_address = if (not dest_address_is_position)
187
- [rows.min..rows.max,columns.min..columns.max]
188
- else
189
- if (not options[:transpose])
190
- [rows.min..rows.min+self.Rows.Count-1,
191
- columns.min..columns.min+self.Columns.Count-1]
192
- else
193
- [rows.min..rows.min+self.Columns.Count-1,
194
- columns.min..columns.min+self.Rows.Count-1]
195
- end
196
- end
197
- dest_range = dest_sheet.range(dest_range_address)
198
- begin
199
- if options[:values_only]
200
- dest_range.Value = options[:transpose] ? self.Value.transpose : self.Value
201
- else
202
- if dest_range.worksheet.workbook.excel == @worksheet.workbook.excel
203
- if options[:transpose]
204
- self.Copy
205
- #dest_range.PasteSpecial('transpose' => true)
206
- dest_range.PasteSpecial(XlPasteAll,XlPasteSpecialOperationNone,false,true)
207
- else
208
- #self.Copy('destination' => dest_range.ole_range)
209
- self.Copy(dest_range.ole_range)
210
- end
211
- else
212
- if options[:transpose]
213
- added_sheet = @worksheet.workbook.add_sheet
214
- self.copy_special(dest_address, added_sheet, :transpose => true)
215
- added_sheet.range(dest_range_address).copy_special(dest_address,dest_sheet)
216
- @worksheet.workbook.excel.with_displayalerts(false) {added_sheet.Delete}
217
- else
218
- self.Copy
219
- #dest_sheet.Paste('destination' => dest_range.ole_range)
220
- dest_sheet.Paste(dest_range.ole_range)
221
- end
222
- end
223
- end
224
- rescue WIN32OLERuntimeError, Java::OrgRacobCom::ComFailException => msg
225
- raise RangeNotCopied, 'cannot copy range'
226
- end
227
- end
228
-
229
168
  def == other_range
230
169
  other_range.is_a?(Range) &&
231
170
  self.worksheet == other_range.worksheet
@@ -249,12 +188,13 @@ module RobustExcelOle
249
188
 
250
189
  # @private
251
190
  def to_s
252
- "#<REO::Range: " + "[#{@rows},#{@columns}] " + "#{worksheet.Name} " + ">"
191
+ "#<REO::Range: " + "#{@ole_range.Address('External' => true).gsub(/\$/,'')} " + ">"
192
+ # "#<REO::Range: " + "#{@ole_range.Address.gsub(/\$/,'')} " + "#{worksheet.Name} " + ">"
253
193
  end
254
194
 
255
195
  # @private
256
196
  def inspect
257
- self.to_s
197
+ to_s # [0..-2] + "#{worksheet.workbook.Name} " + ">"
258
198
  end
259
199
 
260
200
  # @private
@@ -1,3 +1,3 @@
1
1
  module RobustExcelOle
2
- VERSION = "1.21"
2
+ VERSION = "1.22"
3
3
  end
@@ -823,11 +823,12 @@ module RobustExcelOle
823
823
  opts = sheet
824
824
  sheet = nil
825
825
  end
826
- new_sheet_name = opts.delete(:as)
827
- last_sheet_local = last_sheet
828
- after_or_before, base_sheet = opts.to_a.first || [:after, last_sheet_local]
829
- base_sheet_ole = base_sheet.ole_worksheet
830
826
  begin
827
+ sheet = sheet.to_reo unless sheet.nil?
828
+ new_sheet_name = opts.delete(:as)
829
+ last_sheet_local = last_sheet
830
+ after_or_before, base_sheet = opts.to_a.first || [:after, last_sheet_local]
831
+ base_sheet_ole = base_sheet.to_reo.ole_worksheet
831
832
  if !::COPYSHEETS_JRUBY_BUG
832
833
  add_or_copy_sheet_simple(sheet, { after_or_before.to_s => base_sheet_ole })
833
834
  else
@@ -843,7 +844,7 @@ module RobustExcelOle
843
844
  end
844
845
  end
845
846
  end
846
- rescue WIN32OLERuntimeError, NameNotFound, Java::OrgRacobCom::ComFailException
847
+ rescue # WIN32OLERuntimeError, NameNotFound, Java::OrgRacobCom::ComFailException
847
848
  raise WorksheetREOError, "could not add given worksheet #{sheet.inspect}"
848
849
  end
849
850
  new_sheet = worksheet_class.new(ole_workbook.Activesheet)
@@ -892,7 +893,7 @@ module RobustExcelOle
892
893
  # @param [String] name the name of the range
893
894
  # @param [Variant] value the contents of the range
894
895
  def []= (name, value)
895
- set_namevalue_glob(name, value, :color => 42)
896
+ set_namevalue_glob(name, value)
896
897
  end
897
898
 
898
899
  # sets options
@@ -921,7 +922,7 @@ module RobustExcelOle
921
922
 
922
923
  # returns the full file name of the workbook
923
924
  def filename
924
- @ole_workbook.Fullname.tr('\\','/') rescue nil
925
+ General.canonize(@ole_workbook.Fullname.tr('\\','/')) rescue nil
925
926
  end
926
927
 
927
928
  # @private
@@ -96,7 +96,7 @@ module RobustExcelOle
96
96
  else
97
97
  name, value = p1, p2
98
98
  begin
99
- set_namevalue_glob(name, value, :color => 42)
99
+ set_namevalue_glob(name, value)
100
100
  rescue REOError
101
101
  begin
102
102
  workbook.set_namevalue_glob(name, value)
@@ -258,7 +258,7 @@ module RobustExcelOle
258
258
 
259
259
  # @private
260
260
  def inspect
261
- self.to_s
261
+ self.to_s[0..-2] + "#{workbook.Name} " + ">"
262
262
  end
263
263
 
264
264
  include MethodHelpers
data/reo.bat ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ ruby lib/reo_console.rb
@@ -52,7 +52,7 @@ module RobustExcelOle
52
52
  ole_table = worksheet.ListObjects.Item(1)
53
53
  table = Table.new(ole_table)
54
54
  table.Name.should == "table3"
55
- table.HeaderRowRange.Value.first.should == ["Number","Person","Amount","Time","Date"]
55
+ table.HeaderRowRange.Value.first.should == ["Number","Person","Amount","Time","Price"]
56
56
  table.ListRows.Count.should == 6
57
57
  worksheet[3,4].Value.should == "Number"
58
58
  end
@@ -151,13 +151,11 @@ module RobustExcelOle
151
151
  end
152
152
 
153
153
  it "should do methods for sheet" do
154
- # ((@ole_sheet_methods + @sheet_methods) - @book1.sheet(1).methods).should be_empty
155
- (Object.instance_methods.select{|m| m =~ /^(?!\_)/} - @book1.sheet(1).methods).sort.should be_empty
154
+ ((@ole_sheet_methods + @sheet_methods) - @book1.sheet(1).methods).should be_empty
156
155
  end
157
156
 
158
157
  it "should do own_methods with popular ole_excel and excel methods" do
159
- # ((@ole_sheet_methods + @sheet_methods) - @book1.sheet(1).own_methods).should == [] #be_empty
160
- (Object.instance_methods - @book1.sheet(1).own_methods).should == Object.instance_methods
158
+ ((@ole_sheet_methods + @sheet_methods) - @book1.sheet(1).own_methods).should == [] #be_empty
161
159
  end
162
160
 
163
161
  it "should respond to popular sheet methods" do
@@ -223,10 +221,12 @@ module RobustExcelOle
223
221
  canonize("this../.i.s/.../..the/..../pa.th/").should == "this../.i.s/.../..the/..../pa.th"
224
222
  end
225
223
 
224
+ =begin
226
225
  it "should downcase" do
227
226
  canonize("/This/IS/tHe/path").should == "/this/is/the/path"
228
227
  canonize("///THIS/.///./////iS//the/../PatH/////").should == "/this/is/path"
229
228
  end
229
+ =end
230
230
 
231
231
  it "should raise an error for no strings" do
232
232
  expect{
@@ -234,14 +234,13 @@ module RobustExcelOle
234
234
  }.to raise_error(TypeREOError, "No string given to canonize, but 1")
235
235
  end
236
236
 
237
- it "should yield the hostname share path" do
238
- General.canonize(@network_path).should == normalize(@hostname_share_path).downcase
239
- General.canonize(@hostname_share_path).should == normalize(@hostname_share_path).downcase
240
- General.canonize(@simple_file).should == normalize(@simple_file).downcase
241
- General.canonize(@simple_file_extern).should == normalize(@simple_file_extern).downcase
237
+ it "should yield the network path" do
238
+ General.canonize(@hostname_share_path).should == @network_path
239
+ General.canonize(@network_path).should == @network_path
240
+ General.canonize(@simple_file).should == @simple_file
241
+ General.canonize(@simple_file_extern).should == @simple_file_extern
242
242
  end
243
243
 
244
-
245
244
  end
246
245
  end
247
246
 
@@ -763,7 +763,7 @@ describe Workbook do
763
763
  @book1.Names.Item("new").RefersToRange.Interior.ColorIndex.should == 4
764
764
  @book1["new"].should == "bar"
765
765
  @book1["new"] = "bar"
766
- @book1.Names.Item("new").RefersToRange.Interior.ColorIndex.should == 42
766
+ @book1.Names.Item("new").RefersToRange.Interior.ColorIndex.should == 4
767
767
  @book1.save
768
768
  @book1.close
769
769
  #book2 = Workbook.open(@simple_file1, :visible => true)
@@ -777,7 +777,7 @@ describe Workbook do
777
777
  @book1.Names.Item("new").RefersToRange.Interior.ColorIndex.should == 4
778
778
  @book1["new"].should == "bar"
779
779
  @book1["new"] = "bar"
780
- @book1.Names.Item("new").RefersToRange.Interior.ColorIndex.should == 42
780
+ @book1.Names.Item("new").RefersToRange.Interior.ColorIndex.should == 4
781
781
  @book1.save
782
782
  @book1.close
783
783
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robust_excel_ole
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.21'
4
+ version: '1.22'
5
5
  platform: ruby
6
6
  authors:
7
7
  - traths
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-05 00:00:00.000000000 Z
11
+ date: 2020-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -132,6 +132,7 @@ files:
132
132
  - lib/robust_excel_ole/workbook.rb
133
133
  - lib/robust_excel_ole/worksheet.rb
134
134
  - lib/spec_helper.rb
135
+ - reo.bat
135
136
  - robust_excel_ole.gemspec
136
137
  - spec/address_tool_spec.rb
137
138
  - spec/base_spec.rb