Created
December 14, 2012 10:15
-
-
Save randym/4284284 to your computer and use it in GitHub Desktop.
Collapsed outline level
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#```ruby | |
wb.add_worksheet(name: 'outline_level') do |sheet| | |
sheet.add_row [1, 2, 3, 4, Time.now, 149455.15] | |
sheet.add_row [1, 2, 5, 6, Time.now,14100.19] | |
sheet.add_row [9500002267, 1212, 1212, Time.now,14100.19] | |
sheet.add_row [], :collapsed => 1 | |
sheet.rows[0..2].each do |row| | |
row.outline_level = 1 | |
# This will collapse the outline level rows | |
row.hidden = true | |
end | |
sheet.column_info[0..2].each do |col| | |
col.outline_level = 1 | |
#This will collapse the outline level cols | |
col.hidden = true | |
end | |
# This will show the show the [+] symbols | |
sheet.sheet_view do |view| | |
view.show_outline_symbols=true | |
end | |
end | |
#``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm thinking this could be made a bit easier by adding something to worksheet like:
So Ive added two helper methods to worksheet.
You can do the same thing as you have above by calling
It will enable the outline symbols and collapse the rows by default.
Ive added a similar method for outline_columns as well.