Skip to content

Conversation

@sato-s
Copy link
Contributor

@sato-s sato-s commented Feb 12, 2017

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}" 

@sato-s
Copy link
Contributor Author

sato-s commented Feb 12, 2017

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?

@randym
Copy link
Owner

randym commented Feb 6, 2018

Hi @sato-s -

How do you feel about just returning 'A1' for the top_left helper method?

@sato-s
Copy link
Contributor Author

sato-s commented Feb 13, 2018

@randym
Thanks for your feedback.
I'll take care of it later.

sato-s and others added 2 commits March 4, 2018 13:55
This patch introduce following methods to easily use auto_filter,
table, etc.

- Worksheet#top_left_reference
- Worksheet#bottom_right_reference
- Worksheet#range_reference
@sato-s
Copy link
Contributor Author

sato-s commented Mar 4, 2018

@randym
I took care of it.
Also, I rebased this branch so that I can pass ci successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants