robust_excel_ole 1.18.3 → 1.18.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e27445ccdfcf45a843bf7d4271a36f9ced4b8ab8a0e78212ee4d6f10b5fe4aca
4
- data.tar.gz: 9aaf9daad0c04d97161dad9bfd3836504812b9581e78ce94eceb1c24ba43705a
3
+ metadata.gz: 6bdaf693eb1eaf0e68b2ec35417b2194be57ee185edb9f85042e97cee19ac3f8
4
+ data.tar.gz: 8bab1df47739691b6085c4555227df98f7d7b80fc9e2b06ce05b0e182aec132c
5
5
  SHA512:
6
- metadata.gz: 9748c186da786a3af11bb47215891f2082dee540b1ef2870512393db02d8f5f685b14e58668e9047f2dcc4793d128c750bf26ae18f9f19e19bc68a5577d9ef2e
7
- data.tar.gz: 9e1d163cc6e6c035cb6621aaafbc6701785e553cf8a19f7b0fe7936a0253b1f298864a6905319b4501fb9cece53d512083dd0148abc3571eae9326b9966d8329
6
+ metadata.gz: bcb290fa110ebc385baf39094509144d1b8ab2972da127c119ccbf71fd477ada33f837fd0a37b97b5ce7a1affbf952a1600c96e2d2216f06433f3a582f3499fc
7
+ data.tar.gz: 5dbb624113ab19f2539a8b6531d3c2cbc3a23ed0765f35e679205fcdf3518f106ad718cee2f6e7fdbfcdc919173e591d41deb0002e75fd246916e8e4cb4f78bd
@@ -4,7 +4,7 @@ require 'simple_xlsx_reader'
4
4
  start_time = Time.now
5
5
 
6
6
  # ============================================
7
- # =========== Read Example ===============
7
+ # =========== Read Example ==============
8
8
  # ============================================
9
9
 
10
10
  workbook = SimpleXlsxReader.open './sample_excel_files/xlsx_500_rows.xlsx'
@@ -8,7 +8,7 @@ start_time = Time.now
8
8
  # ============================================
9
9
 
10
10
  # Note: spreadsheet only supports .xls files (not .xlsx)
11
- workbook = Spreadsheet.open './sample_excel_files/xls_500_rows.xls'
11
+ workbook = Spreadsheet.open './sample_excel_files/xls_25000_rows.xls'
12
12
 
13
13
  worksheets = workbook.worksheets
14
14
  puts "Found #{worksheets.count} worksheets"
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env jruby
2
+ # -*- mode: jruby -*-
3
+
4
+ require 'robust_excel_ole'
5
+ include REO
6
+ # include RobustExcelOle
7
+ include General
8
+
9
+ require 'irb'
10
+ require 'irb/completion'
11
+ require 'irb/ext/save-history'
12
+ #gem 'jruby-readline'
13
+
14
+ ARGV.concat ['--readline',
15
+ '--prompt-mode',
16
+ 'simple']
17
+ # '-rjruby-readline']
18
+
19
+ #IRB.conf[:PROMPT_MODE] = :SIMPLE
20
+ #IRB.conf[:USE_READLINE] = true
21
+ #IRB.conf[:AUTO_INDENT] = true
22
+
23
+
24
+
25
+
26
+ # 250 entries in the list
27
+ IRB.conf[:SAVE_HISTORY] = 250
28
+
29
+ # Store results in home directory with specified file name
30
+ # IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-history"
31
+ #IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
32
+
33
+ IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.reo-history"
34
+
35
+ # @private
36
+ module Readline
37
+ module Hist
38
+ LOG = IRB.conf[:HISTORY_FILE]
39
+ # LOG = "#{ENV['HOME']}/.irb-history"
40
+
41
+ def self.write_log(line)
42
+ File.open(LOG, 'ab') do |f|
43
+ f << "#{line}
44
+ "
45
+ end
46
+ end
47
+
48
+ def self.start_session_log
49
+ timestamp = proc { Time.now.strftime('%Y-%m-%d, %H:%M:%S') }
50
+ # @private
51
+ class <<timestamp
52
+ alias_method :to_s, :call
53
+ end
54
+ write_log("###### session start: #{timestamp}")
55
+ at_exit { write_log("###### session stop: #{timestamp}") }
56
+ end
57
+ end
58
+
59
+ alias old_readline readline
60
+ def readline(*args)
61
+ ln = old_readline(*args)
62
+ begin
63
+ Hist.write_log(ln)
64
+ rescue StandardError
65
+ end
66
+ ln
67
+ end
68
+ end
69
+
70
+ Readline::Hist.start_session_log
71
+ puts 'JREO console started'
72
+
73
+
74
+ IRB.start
data/bin/reo ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env jruby
2
+ # -*- mode: jruby -*-
3
+
4
+ require 'robust_excel_ole'
5
+ include REO
6
+ # include RobustExcelOle
7
+ include General
8
+
9
+ require 'irb'
10
+ require 'irb/completion'
11
+ require 'irb/ext/save-history'
12
+
13
+ ARGV.concat ['--readline',
14
+ '--prompt-mode',
15
+ 'simple']
16
+
17
+ # 250 entries in the list
18
+ IRB.conf[:SAVE_HISTORY] = 250
19
+
20
+ # Store results in home directory with specified file name
21
+ # IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-history"
22
+ IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.reo-history"
23
+
24
+ # @private
25
+ module Readline
26
+ module Hist
27
+ LOG = IRB.conf[:HISTORY_FILE]
28
+ # LOG = "#{ENV['HOME']}/.irb-history"
29
+
30
+ def self.write_log(line)
31
+ File.open(LOG, 'ab') do |f|
32
+ f << "#{line}
33
+ "
34
+ end
35
+ end
36
+
37
+ def self.start_session_log
38
+ timestamp = proc { Time.now.strftime('%Y-%m-%d, %H:%M:%S') }
39
+ # @private
40
+ class <<timestamp
41
+ alias_method :to_s, :call
42
+ end
43
+ write_log("###### session start: #{timestamp}")
44
+ at_exit { write_log("###### session stop: #{timestamp}") }
45
+ end
46
+ end
47
+
48
+ alias old_readline readline
49
+ def readline(*args)
50
+ ln = old_readline(*args)
51
+ begin
52
+ Hist.write_log(ln)
53
+ rescue StandardError
54
+ end
55
+ ln
56
+ end
57
+ end
58
+
59
+ Readline::Hist.start_session_log
60
+ puts 'REO console started'
61
+ IRB.start
@@ -377,52 +377,7 @@ or
377
377
 
378
378
  worksheet.set_cellval(1,1,"new_value")
379
379
 
380
- === Accessing rows and columns
381
380
 
382
- The methods Worksheet#each, Worksheet#each_row and Worksheet#each_column enable to access each cell, row and column, respectively.
383
-
384
- worksheet.each do |cell|
385
- # do something with cell
386
- # read every row, every column
387
- end
388
-
389
- worksheet.each_row do |row|
390
- # do something with row
391
- end
392
-
393
- worksheet.each_column do |column|
394
- # do something with column
395
- end
396
-
397
- The method Worksheet#values yields all cell values of the used range of the worksheet into a 2-dimensional array. For example:
398
-
399
- worksheet.values
400
- => [["foo", "workbook", "sheet1"], ["foo", nil, "foobaaa"], ["matz", "is", "nice"]]
401
-
402
- The method Worksheet#each_rowvalue provides enable to access the values of each row.
403
-
404
- worksheet.each_rowvalue do |row_values|
405
- # do something with the row_values
406
- end
407
-
408
- You access a range of a row by giving the number of the row, and optionally, the range of the cell numbers.
409
-
410
- worksheet.row_range(1) # => first row
411
- worksheet.row_range(1, 1..3 ) # => first three cells of the first row
412
-
413
- Reading the values is enabled with help of #values:
414
-
415
- worksheet.row_range(1).values
416
-
417
- Simarly you can access a range of a column.
418
-
419
- worksheet.col_range(3) # => third column
420
- worksheet.col_range(3, 1..2) # => first two cells of the third column
421
-
422
- Within a row or column range you can access a certain cell.
423
-
424
- row_range[1] # => first cell in row_range
425
- column_range[2] # => second cell in column_range
426
381
 
427
382
  == Code
428
383
 
@@ -75,6 +75,78 @@ If you want to copy a worksheet, if a worksheet +sheet+ is given, and add an emp
75
75
 
76
76
  Note, that running in jruby, due to some restrictions of jruby, there is a workaround when adding or copy a worksheet at the end (appending): the last worksheet is being copied and deleted afterwards, in order to serve as a dummy worksheet. This may cause a different behaviour.
77
77
 
78
+ === Accessing rows and columns
79
+
80
+ The methods Worksheet#each, Worksheet#each_row and Worksheet#each_column enable to access each cell, row and column, respectively.
81
+
82
+ worksheet.each do |cell|
83
+ # do something with cell
84
+ # read every row, every column
85
+ end
86
+
87
+ worksheet.each_row do |row|
88
+ # do something with row
89
+ end
90
+
91
+ worksheet.each_column do |column|
92
+ # do something with column
93
+ end
94
+
95
+ The method Worksheet#values yields all cell values of the used range of the worksheet into a 2-dimensional array. For example:
96
+
97
+ worksheet.values
98
+ => [["foo", "workbook", "sheet1"], ["foo", nil, "foobaaa"], ["matz", "is", "nice"]]
99
+
100
+ The method Worksheet#each_rowvalue provides enable 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
+ You access a range of a row by giving the number of the row, and optionally, the range of the cell numbers.
107
+
108
+ worksheet.row_range(1) # => first row
109
+ worksheet.row_range(1, 1..3 ) # => first three cells of the first row
110
+
111
+ Reading the values is enabled with help of #values:
112
+
113
+ worksheet.row_range(1).values
114
+
115
+ Simarly you can access a range of a column.
116
+
117
+ worksheet.col_range(3) # => third column
118
+ worksheet.col_range(3, 1..2) # => first two cells of the third column
119
+
120
+ Within a row or column range you can access a certain cell.
121
+
122
+ row_range[1] # => first cell in row_range
123
+ column_range[2] # => second cell in column_range
124
+
125
+ === Deleting and inserting rows and columns
126
+
127
+ As mentioned above, VBA methods can be applied to the RobustExcelOle objects, e.g. when deleting or inserting rows and columns.
128
+
129
+ row1 = worksheet.row_range(1)
130
+ row1.Delete
131
+
132
+ row1.Insert(XlShiftDown,XlFormatFromLeftOrAbove)
133
+
134
+ col1 = worksheet.col_range(1)
135
+ col1.Insert
136
+
137
+ === Getting and setting row height and column width
138
+
139
+ row_hight = row1.RowHight
140
+ row1.RowHeight = row_hight * 2
141
+
142
+ col_width = col1.ColumnWidth
143
+ col1.ColumnWidth = col_width * 2
144
+
145
+ === Vertical and horizontal alignment of contents of rows
146
+
147
+ row1.VerticalAlignment = XlVAlignCenter
148
+ row1.HorizontalAlignment = XlHAlignLeft
149
+
78
150
  == Code
79
151
 
80
152
  worksheet.rb[https://github.com/Thomas008/robust_excel_ole/blob/master/lib/robust_excel_ole/worksheet.rb]
@@ -1,8 +1,9 @@
1
- # require '../robust_excel_ole/lib/robust_excel_ole'
1
+ require '../robust_excel_ole/lib/robust_excel_ole'
2
2
  include REO
3
3
  # include RobustExcelOle
4
4
  include General
5
5
 
6
+ require 'irb'
6
7
  require 'irb/completion'
7
8
  require 'irb/ext/save-history'
8
9
 
@@ -17,6 +18,10 @@ IRB.conf[:SAVE_HISTORY] = 250
17
18
  # IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-history"
18
19
  IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.reo-history"
19
20
 
21
+ IRB.conf[:PROMPT_MODE] = 'ert' #:SIMPLE
22
+ #IRB.conf[:USE_READLINE] = true
23
+ #IRB.conf[:AUTO_INDENT] = true
24
+
20
25
  # @private
21
26
  module Readline
22
27
  module Hist
@@ -54,3 +59,5 @@ end
54
59
 
55
60
  Readline::Hist.start_session_log
56
61
  puts 'REO console started'
62
+ IRB.start
63
+
@@ -1,3 +1,3 @@
1
1
  module RobustExcelOle
2
- VERSION = "1.18.3"
2
+ VERSION = "1.18.8"
3
3
  end
data/reo.bat CHANGED
@@ -1,3 +1,5 @@
1
1
  @echo off
2
2
 
3
- irb -f -r ./lib/robust_excel_ole -r ./lib/reo_console.rb
3
+ irb -f -r ./lib/reo_console.rb
4
+
5
+ #irb -f -r ./lib/robust_excel_ole -r ./lib/reo_console.rb
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.18.3
4
+ version: 1.18.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - traths
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-03 00:00:00.000000000 Z
11
+ date: 2020-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -34,8 +34,8 @@ description: "RobustExcelOle helps controlling Excel. \n This
34
34
  email:
35
35
  - Thomas.Raths@gmx.net
36
36
  executables:
37
- - jreo.bat
38
- - reo.bat
37
+ - jreo
38
+ - reo
39
39
  extensions: []
40
40
  extra_rdoc_files:
41
41
  - README.rdoc
@@ -64,8 +64,8 @@ files:
64
64
  - benchmarking/sample_excel_files/xlsx_500_rows.xlsx
65
65
  - benchmarking/simple_xlsx_reader_example.rb
66
66
  - benchmarking/spreadsheet_example.rb
67
- - bin/jreo.bat
68
- - bin/reo.bat
67
+ - bin/jreo
68
+ - bin/reo
69
69
  - docs/README_excel.rdoc
70
70
  - docs/README_open.rdoc
71
71
  - docs/README_ranges.rdoc
@@ -1,3 +0,0 @@
1
- @echo off
2
-
3
- jirb -f -r ../lib/robust_excel_ole -r ../lib/jreo_console.rb
@@ -1,3 +0,0 @@
1
- @echo off
2
-
3
- irb -f -r ../lib/robust_excel_ole -r ../lib/reo_console.rb