robust_excel_ole 1.18.3 → 1.18.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/benchmarking/simple_xlsx_reader_example.rb +1 -1
- data/benchmarking/spreadsheet_example.rb +1 -1
- data/bin/{jreo.bat → jreo} +0 -0
- data/bin/{reo.bat → reo} +0 -0
- data/docs/README_ranges.rdoc +0 -45
- data/docs/README_sheet.rdoc +72 -0
- data/lib/robust_excel_ole/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf35f3fb5a6a208f408a41bfb4dd72424030458ecbbf51590e457ce63cdaef55
|
4
|
+
data.tar.gz: 04357d405ae6d393480457ffb4d2e21fde6cd8b87a123be6467f1389c83d6727
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8702bb3c42465b1c3c04ccb248fdc6d17f415193fba5ef12d05820517420970b8da04f042de4a562390e21ee8b1f90325eb5826bd012d3aeea0ca3a8640292e5
|
7
|
+
data.tar.gz: 84ce7e871aeb7005441832c97ef68e67da3ef46e20c024ae3c7a51dcef946de13d89902e6a40c8173bd486d9c2a44a9db2e3f8139c2ed0501133b503066821af
|
@@ -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/
|
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"
|
data/bin/{jreo.bat → jreo}
RENAMED
File without changes
|
data/bin/{reo.bat → reo}
RENAMED
File without changes
|
data/docs/README_ranges.rdoc
CHANGED
@@ -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
|
|
data/docs/README_sheet.rdoc
CHANGED
@@ -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]
|
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.
|
4
|
+
version: 1.18.4
|
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-
|
11
|
+
date: 2020-06-09 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
|
38
|
-
- reo
|
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
|
68
|
-
- bin/reo
|
67
|
+
- bin/jreo
|
68
|
+
- bin/reo
|
69
69
|
- docs/README_excel.rdoc
|
70
70
|
- docs/README_open.rdoc
|
71
71
|
- docs/README_ranges.rdoc
|