axlsx
axlsx copied to clipboard
Range reference to easily use some feature (#504)
When we want to use auto_filter or table etc, we have to manually calculate range of auto_filter or table.
For instance,
p.workbook.add_worksheet(:name => "Table") do |sheet|
sheet.add_row ["Build", "Duration", "Finished", "Rvm"]
# Add some row here
sheet.auto_filter = 'A1:D4'
sheet.auto_filter.add_column 3, :filters, :filter_items => ['1.9.2']
end
In the above example, users have to calculate 'A1:D4' before applying auto_filter. This is cumbersome and tend to error, especially when you deal with dynamic length data.
With this fix, all you have to do is ....
sheet.auto_filter = sheet.range_reference
I also made Worksheet#bottom_right_reference. This is useful when you want to apply auto_filter from the row other than 1st row.
sheet.auto_filter = "A2:#{sheet.bottom_right_reference}"
CI failed because nokogiri no longer support ruby 1.9
Gem::InstallError: nokogiri requires Ruby version >= 2.1.0.
An error occurred while installing nokogiri (1.7.0.1), and Bundler cannot
continue.
ruby < 2.1 are EOL. I think we should drop support for 1.9 and 2.0, and start support for 2.1, 2.2, 2.3, 2.4. Should I submit this?
Hi @sato-s -
How do you feel about just returning 'A1' for the top_left helper method?
@randym Thanks for your feedback. I'll take care of it later.
@randym I took care of it. Also, I rebased this branch so that I can pass ci successfully.