summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2013-06-23 10:11:23 +0100
committerRandy Morgan <[email protected]>2013-06-23 10:11:23 +0100
commit86180711acbb7f9c6a04688fc9e6ffbf27bacf19 (patch)
tree336dbcaeb65f9161f2b361c485a8e65976f13357 /lib
parent7caf2ea9dfe92fa418f40132ea3c94d3da109f2c (diff)
downloadcaxlsx-86180711acbb7f9c6a04688fc9e6ffbf27bacf19.tar.gz
caxlsx-86180711acbb7f9c6a04688fc9e6ffbf27bacf19.zip
added sparse array transposition with blocks for rows/cols switching and some docs updates for release prep
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/package.rb12
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb9
2 files changed, 13 insertions, 8 deletions
diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb
index df87ed12..13a3bd13 100644
--- a/lib/axlsx/package.rb
+++ b/lib/axlsx/package.rb
@@ -35,12 +35,6 @@ module Axlsx
end
- # Shortcut to specify that the workbook should use shared strings
- # @see Workbook#use_shared_strings
- def use_shared_strings=(v)
- Axlsx::validate_boolean(v);
- workbook.use_shared_strings = v
- end
# Shortcut to determine if the workbook is configured to use shared strings
# @see Workbook#use_shared_strings
@@ -48,6 +42,12 @@ module Axlsx
workbook.use_shared_strings
end
+ # Shortcut to specify that the workbook should use shared strings
+ # @see Workbook#use_shared_strings
+ def use_shared_strings=(v)
+ Axlsx::validate_boolean(v);
+ workbook.use_shared_strings = v
+ end
# The workbook this package will serialize or validate.
# @return [Workbook] If no workbook instance has been assigned with this package a new Workbook instance is returned.
# @raise ArgumentError if workbook parameter is not a Workbook instance.
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index 1187bf83..7324181a 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -115,8 +115,13 @@ module Axlsx
end
# returns the sheet data as columns
- def cols
- @rows.transpose
+ # If you pass a block, it will be evaluated whenever a row does not have a
+ # cell at a specific index. The block will be called with the row and column
+ # index in the missing cell was found.
+ # @example
+ # cols { |row_index, column_index| p "warn - row #{row_index} is does not have a cell at #{column_index}
+ def cols(&block)
+ @rows.transpose(&block)
end
# An range that excel will apply an auto-filter to "A1:B3"