summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index cd0c6c97..68a3e3c6 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -112,9 +112,10 @@ module Axlsx
# Returns the cell or cells defined using excel style A1:B3 references.
- # @param [String] cell_def the string defining the cell or range of cells
+ # @param [String|Integer] cell_def the string defining the cell or range of cells, or the rownumber
# @return [Cell, Array]
def [](cell_def)
+ return rows[cell_def - 1] if cell_def.is_a? Integer
parts = cell_def.split(':')
first = name_to_cell parts[0]
@@ -234,6 +235,8 @@ module Axlsx
yield @rows.last if block_given?
@rows.last
end
+
+ alias :<< :add_row
# Set the style for cells in a specific row
# @param [Integer] index or range of indexes in the table