diff options
| author | Randy Morgan <[email protected]> | 2012-12-15 10:39:37 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-12-15 10:39:37 +0900 |
| commit | 054de56d12e203a5f0696f98ac9fad3159e7abc1 (patch) | |
| tree | c29ef8fb0bd35ef6170d5aa26cbd9bc8960a0a30 /lib | |
| parent | b1600deadaafdb396c5cc7ca9d448e8adab8ac11 (diff) | |
| download | caxlsx-054de56d12e203a5f0696f98ac9fad3159e7abc1.tar.gz caxlsx-054de56d12e203a5f0696f98ac9fad3159e7abc1.zip | |
Added methods to simplify outlining with specs
worksheet#outline_rows
worksheet#outline_columns
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/pivot_table.rb | 3 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet.rb | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb index d876f777..515f5d09 100644 --- a/lib/axlsx/workbook/worksheet/pivot_table.rb +++ b/lib/axlsx/workbook/worksheet/pivot_table.rb @@ -135,6 +135,9 @@ module Axlsx # identifies the index of an object withing the collections used in generating relationships for the worksheet # @param [Any] object the object to search for # @return [Integer] The index of the object + # + # RM: I cannot find any place in the code base where this is actually used + # TODO: confirm with author before removal def relationships_index_of(object) objects = [cache_definition] objects.index(object) diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index 62d4e557..b6dc7c38 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -608,9 +608,25 @@ module Axlsx @styles ||= self.workbook.styles end + def outline_rows(start_index, end_index, level = 1, collapsed = true) + outline rows, (start_index..end_index), level, collapsed + end + + def outline_columns(start_index, end_index, level = 1, collapsed = true) + outline column_info, (start_index..end_index), level, collapsed + end private + def outline(collection, range, level = 1, collapsed = true) + range.each do |index| + unless (item = collection[index]).nil? + item.outline_level = level + item.hidden = collapsed + end + sheet_view.show_outline_symbols = true + end + end def validate_sheet_name(name) DataTypeValidator.validate "Worksheet.name", String, name raise ArgumentError, (ERR_SHEET_NAME_TOO_LONG % name) if name.size > 31 |
