Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #16 from sakovias/release-0.1.6
Browse files Browse the repository at this point in the history
Release 0.1.6
  • Loading branch information
sakovias authored Sep 18, 2016
2 parents 3b96ca3 + 74247f1 commit 5579251
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Producing the same spreadsheet with vanilla `axlsx` turns out [a bit trickier](.

Version | Change
--------|-------
0.1.6 | Allow mixing vanilla `axlsx` styles and those from `add_style` and `add_border` (see [this example](./examples/mixing_styles.rb))
0.1.5 | Hide `Workbook#apply_styles` method to make it easier to use.
0.1.3 | Make border styles customazible.
0.1.2 | Allow applying multiple style hashes.
4 changes: 3 additions & 1 deletion axlsx_styler.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 1.9.3'

spec.add_dependency 'axlsx', '~> 2.0'
spec.add_dependency 'activesupport', '>= 3.1'
# TODO: extract active_support/core_ext/hash/deep_merge
# and remove the dependency
spec.add_dependency 'activesupport', '~> 3.1'

spec.add_development_dependency 'bundler', '~> 1.6'
spec.add_development_dependency 'rake', '~> 0.9'
Expand Down
22 changes: 22 additions & 0 deletions examples/mixing_styles.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# As of v0.1.6 it is possible to add styles using vanilla axlsx approach
# as well as using add_style and add_border. This is something users have
# been asking for.
#
# The example below is superfluous and the same results are more easily achieved
# without workbook.styles.add_style. You've been warned!
require 'axlsx_styler'

axlsx = Axlsx::Package.new
workbook = axlsx.workbook
red = workbook.styles.add_style fg_color: 'FF0000'
workbook.add_worksheet do |sheet|
sheet.add_row
sheet.add_row ['', 'B2', 'C2', 'D2'], style: [nil, red, nil, nil]
sheet.add_row ['', 'B3', 'C3', 'D3'], style: [nil, red, nil, nil]
sheet.add_row ['', 'B4', 'C4', 'D4'], style: [nil, red, nil, nil]

sheet.add_style 'B2:D2', b: true
sheet.add_border 'B2:D4'
end
workbook.apply_styles
axlsx.serialize File.expand_path('../../tmp/mixing_styles.xlsx', __FILE__)

0 comments on commit 5579251

Please sign in to comment.