diff options
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet.rb | 16 | ||||
| -rw-r--r-- | test/tc_package.rb | 4 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_worksheet.rb | 8 |
3 files changed, 20 insertions, 8 deletions
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index b6dc7c38..26385573 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -608,11 +608,23 @@ module Axlsx @styles ||= self.workbook.styles end - def outline_rows(start_index, end_index, level = 1, collapsed = true) + # shortcut level to specify the outline level for a series of rows + # Oulining is what lets you add collapse and expand to a data set. + # @param [Integer] start_index The zero based index of the first row of outlining. + # @param [Integer] end_index The zero based index of the last row to be outlined + # @param [integer] level The level of outline to apply + # @param [Integer] collapsed The initial collapsed state of the outline group + def outline_level_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) + # shortcut level to specify the outline level for a series of columns + # Oulining is what lets you add collapse and expand to a data set. + # @param [Integer] start_index The zero based index of the first column of outlining. + # @param [Integer] end_index The zero based index of the last column to be outlined + # @param [integer] level The level of outline to apply + # @param [Integer] collapsed The initial collapsed state of the outline group + def outline_level_columns(start_index, end_index, level = 1, collapsed = true) outline column_info, (start_index..end_index), level, collapsed end diff --git a/test/tc_package.rb b/test/tc_package.rb index 8a25d946..5fd411e0 100644 --- a/test/tc_package.rb +++ b/test/tc_package.rb @@ -7,8 +7,8 @@ class TestPackage < Test::Unit::TestCase ws = @package.workbook.add_worksheet ws.add_row ['Can', 'we', 'build it?'] ws.add_row ['Yes!', 'We', 'can!'] - ws.outline_rows 0, 1 - ws.outline_columns 0, 1 + ws.outline_level_rows 0, 1 + ws.outline_level_columns 0, 1 ws.add_hyperlink :ref => ws.rows.first.cells.last, :location => 'https://github.com/randym' ws.workbook.add_defined_name("#{ws.name}!A1:C2", :name => '_xlnm.Print_Titles', :hidden => true) ws.protect_range('A1:C1') diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index 846c2491..8280aca0 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -476,17 +476,17 @@ class TestWorksheet < Test::Unit::TestCase assert(doc.xpath('//sheetPr[@filterMode="true"]')) end - def test_outline_rows + def test_outline_level_rows 3.times { @ws.add_row [1,2,3] } - @ws.outline_rows 0, 2 + @ws.outline_level_rows 0, 2 assert_equal(1, @ws.rows[0].outline_level) assert_equal(true, @ws.rows[2].hidden) assert_equal(true, @ws.sheet_view.show_outline_symbols) end - def test_outline_columns + def test_outline_level_columns 3.times { @ws.add_row [1,2,3] } - @ws.outline_columns 0, 2 + @ws.outline_level_columns 0, 2 assert_equal(1, @ws.column_info[0].outline_level) assert_equal(true, @ws.column_info[2].hidden) assert_equal(true, @ws.sheet_view.show_outline_symbols) |
