Created
July 25, 2012 23:21
-
-
Save randym/3179305 to your computer and use it in GitHub Desktop.
Example: Setting up auto filters / Table with axlsx
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
#Using Tables: | |
#This will add in the sorting filters for you as well as apply default table styling in excel. | |
#LibraOffice does the filters, but not the styling (as does Google docs if I recall correctly.) | |
#```ruby | |
wb.add_worksheet(:name => "Table") do |sheet| | |
sheet.add_row ["Build Matrix"] | |
sheet.add_row ["Build", "Duration", "Finished", "Rvm"] | |
sheet.add_row ["19.1", "1 min 32 sec", "about 10 hours ago", "1.8.7"] | |
sheet.add_row ["19.2", "1 min 28 sec", "about 10 hours ago", "1.9.2"] | |
sheet.add_row ["19.3", "1 min 35 sec", "about 10 hours ago", "1.9.3"] | |
sheet.add_table "A2:D5", :name => 'Build Matrix' | |
end | |
#``` | |
# Using Autofilter | |
# Same result without the styling | |
#```ruby | |
wb.add_worksheet(:name => "Auto Filter") do |sheet| | |
sheet.add_row ["Build Matrix"] | |
sheet.add_row ["Build", "Duration", "Finished", "Rvm"] | |
sheet.add_row ["19.1", "1 min 32 sec", "about 10 hours ago", "1.8.7"] | |
sheet.add_row ["19.2", "1 min 28 sec", "about 10 hours ago", "1.9.2"] | |
sheet.add_row ["19.3", "1 min 35 sec", "about 10 hours ago", "1.9.3"] | |
sheet.auto_filter = "A2:D5" | |
end | |
#``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment