robust_excel_ole 1.34 → 1.35

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: 367d0c217ed968287f98cbf62cc786df14d364799f2dec633848af78eb6ce1f0
4
- data.tar.gz: de1a58c99a761ae005142a7bf302cab13b3b64021605e000e05ec2d783246fa2
3
+ metadata.gz: 80365f36774968b6f55052177932c00dbe57b7fb3bee76762474a0b21637440b
4
+ data.tar.gz: a352fd270609529688869edf581bc2d1c20eee9c0b9b8ec61198dcfafc82fd2b
5
5
  SHA512:
6
- metadata.gz: 65361e347cb55f05bc6d24c6a85f3f3b19696cf057dbc71c14cb86a7c3d8bfc28aca247231cc3a90409d933ca3944104f40e006d2591dfe55f60f84a30f75619
7
- data.tar.gz: db86b776ff9359c8ebb3893d1bbc103aacfae6f408dc0358f7b32367312b80096d47a3aed682b7ec367f2a41eb64cef9ac8c3aa9fcc021c8ac05b9e8babb70cf
6
+ metadata.gz: 5246534fa3c3767e9fe4c8081d37aac6d54070238b6008d1ea289792cc3fa2bbf3b855b36eab4959b16103af6e5f8a83d7d326dc82923ff25c82ab8b9f61ae1e
7
+ data.tar.gz: '070856a21a1786fa7f9fd3de02edaa6bf661e936329c02afb78e9d5ddbd8623b95a49ec1f22be64e4d205c47e4c7e7c2bf964a00d2928a2d4dbe4a6640bf3a40'
data/README.rdoc CHANGED
@@ -225,7 +225,7 @@ If the Excel instance is damaged or closed, then options control whether the wor
225
225
 
226
226
  Without the option +:default+, the workbook can be forced to be opened in the current, new or given Excel instance, no matter if and where it was opened before, e.g.
227
227
 
228
- workbook2 = Workbook.open('spec/data/workbook.xls', excel: excel1)
228
+ workbook2 = Workbook.open('spec/data/workbook.xls', excel: new)
229
229
 
230
230
  === Managing conflicts with unsaved and blocking workbooks
231
231
 
@@ -253,14 +253,6 @@ We access the first worksheet by
253
253
 
254
254
  worksheet = workbook.sheet(1)
255
255
 
256
- or
257
-
258
- worksheet = workbook.sheet('Sheet1')
259
-
260
- or
261
-
262
- worksheet = workbook.first_sheet
263
-
264
256
  We can read and change the worksheet name.
265
257
 
266
258
  worksheet.name
@@ -280,12 +272,10 @@ We can define a rectangular range by providing the top left and the bottum down
280
272
 
281
273
  worksheet.range([1..3,1..4])
282
274
 
283
- We can read the first cell, using
284
-
285
- worksheet[1,1]. # => "foo"
286
-
287
- Then we modify it.
275
+ We can read and modify the first cell, e.g.
288
276
 
277
+ worksheet[1,1]
278
+ # => "foo"
289
279
  worksheet[1,1] = "hello"
290
280
 
291
281
  We get the value of a named range
@@ -319,15 +309,15 @@ You can get all or a maximal number of list rows matching the key.
319
309
  rows = table[{"Number": 1}, limit: nil]
320
310
  rows = table[{"Number": 1}, limit: 2]
321
311
 
322
- Now we can set 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.
312
+ Now we can read and set the value of a cell of the table with help of methods that are underscored variants of the column names, e.g.
323
313
 
324
314
  row1.person = "John"
325
315
 
326
- or
316
+ or with help of the column name
327
317
 
328
318
  row1["Person"] = "John"
329
319
 
330
- Similarly you can get the values. We can also read all values in a row.
320
+ We can also read all values in a row.
331
321
 
332
322
  table[1].to_a
333
323
  # => ["John", 40]
@@ -335,24 +325,11 @@ Similarly you can get the values. We can also read all values in a row.
335
325
  table[1].to_h
336
326
  # => {"Person": "John", "AmountSales": 40}
337
327
 
338
- We can set the values in a whole row.
339
-
340
- table[1].values = ["Herber", 80]
341
-
342
- Similarly, we can read and set the values in a whole column, e.g.
343
-
344
- table.column_values("Person")
345
- # => ["John", "Peter"]
346
-
347
- and
348
-
349
- table.set_column_values(1, ["Herbert","Paul"])
350
-
351
328
  For more details about using and processing list objects see {README_listobjects}[https://github.com/Thomas008/robust_excel_ole/blob/master/docs/README_listobjects.rdoc]
352
329
 
353
330
  === More features
354
331
 
355
- 1. 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 now the RobustExcelOle objects and their wrapped WIN32OLE objects are interchangeable. One example would be
332
+ 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 now the RobustExcelOle objects and their wrapped WIN32OLE objects are interchangeable. One example would be
356
333
 
357
334
  range.ole_range.copy([4,3])
358
335
 
@@ -362,20 +339,6 @@ Likewise it is possible to convert ("type-lift") WIN32OLE objects into the corre
362
339
 
363
340
  range = sheet.Names.Item("firstcell").to_reo
364
341
 
365
- 2. The method +General.change_current_binding+ allows to change the value of self within the current binding, while preserving the local variables, without starting another repl. Assume, +object+ shall be the self, then you would put
366
-
367
- General.change_current_binding(object)
368
-
369
- Without this method, the ruby shell 'pry' allows to change the value of 'self' in the console as well, e.g.
370
-
371
- object.pry
372
-
373
- or
374
-
375
- cd object
376
-
377
- However, this command also starts another pry repl (with another binding). Moreover, local variables in the previous binding are forgotten.
378
-
379
342
  === Design issues
380
343
 
381
344
  We don't consider active worksheets or workbooks in our implementation, because this has been proven to be very error-prone.
@@ -60,6 +60,8 @@ module RobustExcelOle
60
60
  end
61
61
  end
62
62
 
63
+ =begin
64
+
63
65
  ole_table = @ole_table
64
66
 
65
67
  @row_class = Class.new(ListRow) do
@@ -74,6 +76,37 @@ module RobustExcelOle
74
76
 
75
77
  end
76
78
 
79
+ =end
80
+
81
+ ole_table = @ole_table
82
+
83
+ @row_class = Class.new(ListRow) do
84
+
85
+ @ole_table = ole_table
86
+
87
+ #def ole_table
88
+ # self.class.instance_variable_get(:ole_table)
89
+ #end
90
+
91
+ def ole_table
92
+ self.class.ole_table
93
+
94
+ end
95
+
96
+ def self.ole_table
97
+ @ole_table
98
+ end
99
+
100
+ def self.ole_table= tab
101
+ @ole_table = tab
102
+ end
103
+
104
+ end
105
+
106
+ @row_class.ole_table = @ole_table
107
+
108
+ end
109
+
77
110
  # @return [Enumerator] traversing all list row objects
78
111
  def each
79
112
  if block_given?
@@ -130,13 +130,7 @@ module RobustExcelOle
130
130
  private
131
131
 
132
132
  def define_and_call_method(column_name,method_name,*args)
133
- puts "define_and_call_method:"
134
- puts "column_name: #{column_name} #{column_name.inspect}"
135
133
  #column_name = column_name.force_encoding('cp850')
136
- puts "after force_encoding: column_name: #{column_name} #{column_name.inspect}"
137
- puts "ole_table.ListColumns: #{ole_table.ListColumns.inspect}"
138
- column1 = ole_table.ListColumns.Item(column_name)
139
- puts "column1: #{column1.inspect}"
140
134
  ole_cell = ole_table.Application.Intersect(
141
135
  @ole_tablerow.Range, ole_table.ListColumns.Item(column_name).Range)
142
136
  define_getting_setting_method(ole_cell,method_name)
@@ -1,3 +1,3 @@
1
1
  module RobustExcelOle
2
- VERSION = "1.34"
2
+ VERSION = "1.35"
3
3
  end
Binary file
@@ -45,6 +45,19 @@ describe ListRow do
45
45
 
46
46
  end
47
47
 
48
+ describe "accessing several tables" do
49
+
50
+ it "should preserve the table when accessing table rows in several tables" do
51
+ table1 = @sheet.table(1)
52
+ values1 = table1[1].values
53
+ table2 = Table.new(@sheet, "table_name", [1,1], 3, ["Person","Amount"])
54
+ values2 = table2[1].values
55
+ table1[1].values.should == values1
56
+ table1[1].values.should_not == values2
57
+ end
58
+
59
+ end
60
+
48
61
  describe "promote" do
49
62
 
50
63
  it "should promote a win32ole tablerow" do
@@ -174,6 +187,7 @@ describe ListRow do
174
187
  @table_row1.verkaeufer.should be nil
175
188
  @table_row1.verkaeufer = "John"
176
189
  @table_row1.verkaeufer.should == "John"
190
+ @table_row1.verkäufer.should == "John"
177
191
  @sheet[2,1].should == "John"
178
192
  @table_row1.Verkaeufer = "Herbert"
179
193
  @table_row1.Verkaeufer.should == "Herbert"
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.34'
4
+ version: '1.35'
5
5
  platform: ruby
6
6
  authors:
7
7
  - traths
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-17 00:00:00.000000000 Z
11
+ date: 2021-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: win32api