axlsx_styler 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +39 -32
  4. data/Rakefile +18 -4
  5. data/lib/axlsx_styler.rb +4 -57
  6. data/lib/axlsx_styler/axlsx_cell.rb +30 -30
  7. data/lib/axlsx_styler/axlsx_package.rb +17 -0
  8. data/lib/axlsx_styler/axlsx_styles.rb +36 -0
  9. data/lib/axlsx_styler/axlsx_workbook.rb +27 -27
  10. data/lib/axlsx_styler/axlsx_worksheet.rb +26 -26
  11. data/lib/axlsx_styler/version.rb +1 -1
  12. data/test/custom_assertions.rb +21 -0
  13. data/test/dummy_app/Rakefile +7 -0
  14. data/test/dummy_app/app/assets/javascripts/application.js +0 -0
  15. data/test/dummy_app/app/assets/stylesheets/application.css +3 -0
  16. data/test/dummy_app/app/controllers/application_controller.rb +3 -0
  17. data/test/dummy_app/app/controllers/spreadsheets_controller.rb +7 -0
  18. data/test/dummy_app/app/models/application_record.rb +3 -0
  19. data/test/dummy_app/app/views/layouts/application.html.erb +14 -0
  20. data/{examples/colors_and_borders.rb → test/dummy_app/app/views/spreadsheets/test.xlsx.axlsx} +2 -7
  21. data/test/dummy_app/config.ru +4 -0
  22. data/test/dummy_app/config/application.rb +63 -0
  23. data/test/dummy_app/config/boot.rb +10 -0
  24. data/test/dummy_app/config/database.yml +25 -0
  25. data/test/dummy_app/config/environment.rb +5 -0
  26. data/test/dummy_app/config/environments/development.rb +30 -0
  27. data/test/dummy_app/config/environments/production.rb +60 -0
  28. data/test/dummy_app/config/environments/test.rb +41 -0
  29. data/test/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
  30. data/test/dummy_app/config/initializers/inflections.rb +10 -0
  31. data/test/dummy_app/config/initializers/mime_types.rb +5 -0
  32. data/test/dummy_app/config/initializers/secret_token.rb +11 -0
  33. data/test/dummy_app/config/initializers/session_store.rb +8 -0
  34. data/test/dummy_app/config/initializers/wrap_parameters.rb +14 -0
  35. data/test/dummy_app/config/locales/en.yml +5 -0
  36. data/test/dummy_app/config/routes.rb +3 -0
  37. data/test/dummy_app/config/secrets.yml +22 -0
  38. data/test/dummy_app/db/schema.rb +15 -0
  39. data/test/dummy_app/db/test.sqlite3 +0 -0
  40. data/test/dummy_app/log/test.log +730 -0
  41. data/test/helper_methods.rb +12 -0
  42. data/test/integration/application_test.rb +18 -0
  43. data/test/test_helper.rb +29 -5
  44. data/test/unit/borders_test.rb +127 -0
  45. data/test/unit/examples_test.rb +20 -0
  46. data/test/unit/general_test.rb +84 -0
  47. data/test/unit/merge_styles_test.rb +56 -0
  48. data/test/unit/serialize_test.rb +34 -0
  49. data/test/unit/to_stream_test.rb +34 -0
  50. metadata +136 -56
  51. data/.gitignore +0 -26
  52. data/.travis.yml +0 -7
  53. data/Appraisals +0 -7
  54. data/Gemfile +0 -4
  55. data/axlsx_styler.gemspec +0 -37
  56. data/examples/mixing_styles.rb +0 -22
  57. data/examples/vanilla_axlsx.md +0 -70
  58. data/gemfiles/axlsx_2.gemfile +0 -7
  59. data/gemfiles/axlsx_3.gemfile +0 -7
  60. data/spreadsheet.png +0 -0
  61. data/test/cell_test.rb +0 -14
  62. data/test/integration_test.rb +0 -288
  63. data/test/workbook_test.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 57172ec25d3c09d1fc97016dfa3c2e4671fcf0fa
4
- data.tar.gz: 06bcc42c0cac9e19f91e72d4e439feedd71a9ed9
2
+ SHA256:
3
+ metadata.gz: 7afaf1eeca35216610277bc48f73ddbff03344a91a3909d80b7ba43b48c7fe5d
4
+ data.tar.gz: 5cdb2b7dd5bd2a85929271852cdcdc7af2743a7acb6c26bddc0ac2bccab067f4
5
5
  SHA512:
6
- metadata.gz: cd15fa7bf1787b17c3f3d1e3fd70b9652ebedc7d347fb7026e05d451ff777bb3e64b1fd2818c726c467746f243c11e2d31f3484c7a73f81987547af2becfc468
7
- data.tar.gz: 717fe82874512efb01d0d9832e01706ad63203b6705d1170bd4f4b9e7b75a9bbf4e6acf9bb77df9204bbe771d6395a1c3745aecc7e799f88ca5f49ffada97e0d
6
+ metadata.gz: 6a4e8bd27a92224b7fbe74e5f0cafd11756c8b841029b6485837728cdcb79a1f1dd5dc3f55d669e8ae9d4ea55fc82f5cf75a40742f583e7ca76823c10b5abde7
7
+ data.tar.gz: 8a9df17a77ae556b9bc799f4c9834d0a436bb54667bece8a799caaf6c13cb66b5c7e69fe0430e3c4a6913ad395e53d2e033f6d4d89ce5c810afe0fbe90220806
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ - **1.0.0 - January 5, 2020**
4
+ - Switch to the `caxlsx` gem (Community Axlsx) from the legacy unmaintained `axlsx` gem. Axlsx has had a long history of being poorly maintained so this community gem improves the situation.
5
+ - Require Ruby 2.3+
6
+ - Improve Package and Styles monkey patches using `prepend`
7
+ - Removed unnecessary module `AxlsxStyler::Axlsx`
8
+ - Major test suite improvements
9
+ - Add Rails dummy app to test suite and test with `axlsx_rails`
10
+ - **0.2.0**
11
+ - Add support for `axlsx` v3 (at this time for v3.0.0.pre).
12
+ - Update test suite to run against both v2 and v3 of `axlsx`
13
+ - **0.1.7**
14
+ - Allow mixing vanilla `axlsx` styles and those from `add_style` and `add_border`. See [this example](./examples/mixing_styles.rb)
15
+ - **0.1.5**
16
+ - Hide `Workbook#apply_styles` method to make it easier to use.
17
+ - **0.1.3**
18
+ - Make border styles customizable.
19
+ - **0.1.2**
20
+ - Allow applying multiple style hashes.
data/README.md CHANGED
@@ -1,35 +1,34 @@
1
- [![Gem Version](https://badge.fury.io/rb/axlsx_styler.svg)](https://rubygems.org/gems/axlsx_styler)
2
- [![Build Status](https://travis-ci.org/sakovias/axlsx_styler.svg?branch=master)](https://travis-ci.org/sakovias/axlsx_styler)
3
-
4
1
  # axlsx_styler
5
2
 
6
- [axlsx](https://github.com/randym/axlsx) gem is an excellent tool to
7
- build Excel spreadsheets. The sheets are
8
- created row-by-row and styles are immediately added to each cell when a
9
- row is created.
3
+ <a href="https://badge.fury.io/rb/axlsx_styler" target="_blank"><img height="21" style='border:0px;height:21px;' border='0' src="https://badge.fury.io/rb/axlsx_styler.svg" alt="Gem Version"></a>
4
+ <a href='https://travis-ci.org/axlsx-styler-gem/axlsx_styler' target='_blank'><img height='21' style='border:0px;height:21px;' src='https://api.travis-ci.org/axlsx-styler-gem/axlsx_styler.svg?branch=master' border='0' alt='Build Status' /></a>
5
+ <a href='https://rubygems.org/gems/axlsx_styler' target='_blank'><img height='21' style='border:0px;height:21px;' src='https://ruby-gem-downloads-badge.herokuapp.com/axlsx_styler?label=rubygems&type=total&total_label=downloads&color=brightgreen' border='0' alt='RubyGems Downloads' /></a>
6
+
7
+ `axlsx_styler` is a gem that allows you to build clean and maintainable styles for your `axlsx` spreadsheets. Build your spreadsheeet with data and then apply styles later.
8
+
9
+ While [`axlsx`](https://github.com/randym/axlsx) is an excellent tool to build Excel spreadsheets in Ruby, the sheets styles are only applied immediately as the row is created. This makes it very difficult to style easily and effectively.
10
+
11
+ To solve this issue, `axlsx_styler` was born to allow the separatation of styles from content within your `axlsx` code. It gives you the ability to fill out a spreadsheet with data and apply styles later.
10
12
 
11
- `axlsx_styler` allows to separate styles from content: you can fill out
12
- a spreadsheet with data and apply styles later. Paired with
13
- [axlsx_rails](https://github.com/straydogstudio/axlsx_rails) this gem
14
- allows to build clean and maintainable Excel views in a Rails app. It can also
15
- be used outside of any specific Ruby framework as shown in example below.
13
+ Works well in any Rails app or outside of any specific Ruby framework.
16
14
 
17
- ## Usage
15
+ # Usage
18
16
 
19
- This gem provides a DSL that allows you to apply styles to ranges of cells, e.g.
17
+ This gem provides a DSL that allows you to apply styles or borders to ranges of cells.
18
+
19
+ ## Styles
20
20
 
21
21
  ```ruby
22
22
  sheet.add_style 'A1:D10', b: true, sz: 14
23
23
  ```
24
24
 
25
- The styles can be overlayed, so that later on you can add another style
26
- to cells that already have styles, e.g.
25
+ The styles can be overlayed, so that later on you can add another style to cells that already have styles.
27
26
 
28
27
  ```ruby
29
28
  sheet.add_style 'A1:D1', bg_color: 'FF0000'
30
29
  ```
31
30
 
32
- Applying multiple styles as a sequence of Ruby hashes is also possible:
31
+ Applying multiple styles as a sequence of Ruby hashes is also possible.
33
32
 
34
33
  ```ruby
35
34
  bold = { b: true }
@@ -37,25 +36,29 @@ centered = { alignment: { horizontal: :center } }
37
36
  sheet.add_style 'A2:D2', bold, centered
38
37
  ```
39
38
 
40
- You can also add borders to ranges of cells:
39
+ ## Borders
40
+
41
+ The border style is to draw a thin black border on all four edges of the selected cell range.
41
42
 
42
43
  ```ruby
43
44
  sheet.add_border 'B2:D5'
45
+ ```
46
+
47
+ You can easily customize the border styles.
48
+
49
+ ```ruby
44
50
  sheet.add_border 'B2:D5', [:bottom, :right]
45
51
  sheet.add_border 'B2:D5', { edges: [:bottom, :right], style: :thick, color: 'FF0000' }
46
52
  ```
47
53
 
48
- Border parameters are optional. The default is to draw a thin black border on all four edges of the selected cell range.
49
54
 
50
-
51
- ### Example
55
+ ## Example
52
56
 
53
57
  Suppose we want create the following spreadsheet:
54
58
 
55
59
  ![alt text](./spreadsheet.png "Sample Spreadsheet")
56
60
 
57
- You can apply styles after all data is entered, similar to how you'd create
58
- an Excel document by hand:
61
+ You can apply styles after all data is entered, similar to how you'd create an Excel document by hand.
59
62
 
60
63
  ```ruby
61
64
  require 'axlsx_styler'
@@ -82,15 +85,19 @@ end
82
85
  axlsx.serialize 'grocery.xlsx'
83
86
  ```
84
87
 
85
- Producing the same spreadsheet with vanilla `axlsx` turns out [a bit trickier](./examples/vanilla_axlsx.md).
88
+ If you try creating this same spreadsheet using only `axlsx`, you will find this is much more difficult. See this [See this example](./examples/vanilla_axlsx.md)
89
+
90
+ For more examples, please see the [examples folder](./examples/)
91
+
92
+ # Contributing
93
+
94
+ We use the `appraisal` gem for testing multiple versions of `axlsx`. Please use the following steps to test using `appraisal`.
95
+
96
+ 1. `bundle exec appraisal install`
97
+ 2. `bundle exec appraisal rake test`
86
98
 
99
+ # Credits
87
100
 
88
- ## Change log
101
+ Created by Anton Sakovich - @sakovias
89
102
 
90
- Version | Change
91
- --------|-------
92
- 0.2.0 | Add support for `axlsx` major version `3.0.0`. Update test suite to run against v2 and v3 of `axlsx`
93
- 0.1.7 | Allow mixing vanilla `axlsx` styles and those from `add_style` and `add_border` (see [this example](./examples/mixing_styles.rb))
94
- 0.1.5 | Hide `Workbook#apply_styles` method to make it easier to use.
95
- 0.1.3 | Make border styles customizable.
96
- 0.1.2 | Allow applying multiple style hashes.
103
+ Maintained by Weston Ganger - @westonganger - Uses `axlsx_styler` within the gem, [`spreadsheet_architect`](https://github.com/westonganger/spreadsheet_architect)
data/Rakefile CHANGED
@@ -1,7 +1,21 @@
1
1
  require "bundler/gem_tasks"
2
- require 'rake/testtask'
3
2
 
4
- Rake::TestTask.new do |t|
5
- t.libs << 'test'
6
- t.pattern = "test/*_test.rb"
3
+ task :test do
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'lib'
8
+ t.libs << 'test'
9
+ t.pattern = 'test/**/*_test.rb'
10
+ t.verbose = false
11
+ end
12
+ end
13
+
14
+ task default: :test
15
+
16
+ task :console do
17
+ require 'axlsx_styler'
18
+
19
+ require 'irb'
20
+ binding.irb
7
21
  end
@@ -1,65 +1,12 @@
1
1
  require 'axlsx'
2
-
3
2
  require 'axlsx_styler/version'
3
+
4
+ require 'axlsx_styler/axlsx_package'
5
+ require 'axlsx_styler/axlsx_styles'
4
6
  require 'axlsx_styler/axlsx_workbook'
5
7
  require 'axlsx_styler/axlsx_worksheet'
6
8
  require 'axlsx_styler/axlsx_cell'
7
9
 
8
- Axlsx::Workbook.send :include, AxlsxStyler::Axlsx::Workbook
9
- Axlsx::Worksheet.send :include, AxlsxStyler::Axlsx::Worksheet
10
- Axlsx::Cell.send :include, AxlsxStyler::Axlsx::Cell
11
-
12
- module Axlsx
13
- class Package
14
- # Patches the original Axlsx::Package#serialize method so that styles are
15
- # applied when the workbook is saved
16
- original_serialize = instance_method(:serialize)
17
- define_method :serialize do |*args|
18
- workbook.apply_styles if !workbook.styles_applied
19
- original_serialize.bind(self).(*args)
20
- end
21
-
22
- # Patches the original Axlsx::Package#to_stream method so that styles are
23
- # applied when the workbook is converted to StringIO
24
- original_to_stream = instance_method(:to_stream)
25
- define_method :to_stream do |*args|
26
- workbook.apply_styles if !workbook.styles_applied
27
- original_to_stream.bind(self).(*args)
28
- end
29
- end
30
-
31
- class Styles
32
- # An index for cell styles
33
- # {
34
- # 1 => < style_hash >,
35
- # 2 => < style_hash >,
36
- # ...
37
- # K => < style_hash >
38
- # }
39
- # where keys are Cell#raw_style and values are styles
40
- # codes as per Axlsx::Style
41
- attr_accessor :style_index
42
-
43
- # Patches the original Axlsx::Styles#add_style method so that plain axlsx
44
- # styles are added to the axlsx_styler style_index cache
45
- original_add_style = instance_method(:add_style)
46
- define_method :add_style do |style|
47
- self.style_index ||= {}
48
-
49
- raw_style = {type: :xf, name: 'Arial', sz: 11, family: 1}.merge(style)
50
- if raw_style[:format_code]
51
- raw_style.delete(:num_fmt)
52
- end
53
-
54
- index = style_index.key(raw_style)
55
- if !index
56
- index = original_add_style.bind(self).(style)
57
- self.style_index[index] = raw_style
58
- end
59
- return index
60
- end
61
-
62
- private
10
+ module AxlsxStyler
63
11
 
64
- end
65
12
  end
@@ -1,44 +1,44 @@
1
1
  require 'active_support/core_ext/hash/deep_merge'
2
2
 
3
3
  module AxlsxStyler
4
- module Axlsx
5
- module Cell
6
- attr_accessor :raw_style
7
-
8
- def add_style(style)
9
- self.raw_style ||= {}
10
- add_to_raw_style(style)
11
- workbook.add_styled_cell self
12
- end
4
+ module Cell
5
+ attr_accessor :raw_style
13
6
 
14
- private
7
+ def add_style(style)
8
+ self.raw_style ||= {}
9
+ add_to_raw_style(style)
10
+ workbook.add_styled_cell self
11
+ end
15
12
 
16
- def workbook
17
- row.worksheet.workbook
18
- end
13
+ private
19
14
 
20
- def add_to_raw_style(style)
21
- # using deep_merge from active_support:
22
- # with regular Hash#merge adding borders fails miserably
23
- new_style = raw_style.deep_merge style
15
+ def workbook
16
+ row.worksheet.workbook
17
+ end
24
18
 
25
- if with_border?(raw_style) && with_border?(style)
26
- border_at = (raw_style[:border][:edges] || all_edges) + (style[:border][:edges] || all_edges)
27
- new_style[:border][:edges] = border_at.uniq.sort
28
- elsif with_border?(style)
29
- new_style[:border] = style[:border]
30
- end
19
+ def add_to_raw_style(style)
20
+ # using deep_merge from active_support:
21
+ # with regular Hash#merge adding borders fails miserably
22
+ new_style = raw_style.deep_merge style
31
23
 
32
- self.raw_style = new_style
24
+ if with_border?(raw_style) && with_border?(style)
25
+ border_at = (raw_style[:border][:edges] || all_edges) + (style[:border][:edges] || all_edges)
26
+ new_style[:border][:edges] = border_at.uniq.sort
27
+ elsif with_border?(style)
28
+ new_style[:border] = style[:border]
33
29
  end
34
30
 
35
- def with_border?(style)
36
- !style[:border].nil?
37
- end
31
+ self.raw_style = new_style
32
+ end
38
33
 
39
- def all_edges
40
- [:top, :right, :bottom, :left]
41
- end
34
+ def with_border?(style)
35
+ !style[:border].nil?
36
+ end
37
+
38
+ def all_edges
39
+ [:top, :right, :bottom, :left]
42
40
  end
43
41
  end
44
42
  end
43
+
44
+ Axlsx::Cell.send(:include, AxlsxStyler::Cell)
@@ -0,0 +1,17 @@
1
+ module AxlsxStyler
2
+ module Package
3
+
4
+ def serialize(*args)
5
+ workbook.apply_styles if !workbook.styles_applied
6
+ super
7
+ end
8
+
9
+ def to_stream(*args)
10
+ workbook.apply_styles if !workbook.styles_applied
11
+ super
12
+ end
13
+
14
+ end
15
+ end
16
+
17
+ Axlsx::Package.send(:prepend, AxlsxStyler::Package)
@@ -0,0 +1,36 @@
1
+ module AxlsxStyler
2
+ module Styles
3
+
4
+ # An index for cell styles
5
+ # {
6
+ # 1 => < style_hash >,
7
+ # 2 => < style_hash >,
8
+ # ...
9
+ # K => < style_hash >
10
+ # }
11
+ # where keys are Cell#raw_style and values are styles codes as per Axlsx::Style
12
+ attr_accessor :style_index
13
+
14
+ # Ensure plain axlsx styles are added to the axlsx_styler style_index cache
15
+ def add_style(*args)
16
+ style = args.first
17
+
18
+ self.style_index ||= {}
19
+
20
+ raw_style = {type: :xf, name: 'Arial', sz: 11, family: 1}.merge(style)
21
+ if raw_style[:format_code]
22
+ raw_style.delete(:num_fmt)
23
+ end
24
+
25
+ index = style_index.key(raw_style)
26
+ if !index
27
+ index = super
28
+ self.style_index[index] = raw_style
29
+ end
30
+ return index
31
+ end
32
+
33
+ end
34
+ end
35
+
36
+ Axlsx::Styles.send(:prepend, AxlsxStyler::Styles)
@@ -2,36 +2,36 @@ require 'set'
2
2
  require 'active_support/core_ext/hash/deep_merge'
3
3
 
4
4
  module AxlsxStyler
5
- module Axlsx
6
- module Workbook
7
- # An array that holds all cells with styles
8
- attr_accessor :styled_cells
9
-
10
- # Checks if styles are indexed to make it work for pre 0.1.5 version
11
- # users that still explicitly call @workbook.apply_styles
12
- attr_accessor :styles_applied
13
-
14
- def add_styled_cell(cell)
15
- self.styled_cells ||= Set.new
16
- self.styled_cells << cell
17
- end
5
+ module Workbook
6
+ # An array that holds all cells with styles
7
+ attr_accessor :styled_cells
8
+
9
+ # Checks if styles are indexed to make it work for pre 0.1.5 version
10
+ # users that still explicitly call @workbook.apply_styles
11
+ attr_accessor :styles_applied
12
+
13
+ def add_styled_cell(cell)
14
+ self.styled_cells ||= Set.new
15
+ self.styled_cells << cell
16
+ end
17
+
18
+ def apply_styles
19
+ return unless styled_cells
18
20
 
19
- def apply_styles
20
- return unless styled_cells
21
-
22
- styled_cells.each do |cell|
23
- if styles.style_index && styles.style_index[cell.style]
24
- current_style = styles.style_index[cell.style]
25
- new_style = current_style.deep_merge(cell.raw_style)
26
- else
27
- new_style = cell.raw_style
28
- end
29
-
30
- cell.style = styles.add_style(new_style)
21
+ styled_cells.each do |cell|
22
+ if styles.style_index && styles.style_index[cell.style]
23
+ current_style = styles.style_index[cell.style]
24
+ new_style = current_style.deep_merge(cell.raw_style)
25
+ else
26
+ new_style = cell.raw_style
31
27
  end
32
- self.styles_applied = true
33
- end
34
28
 
29
+ cell.style = styles.add_style(new_style)
30
+ end
31
+ self.styles_applied = true
35
32
  end
33
+
36
34
  end
37
35
  end
36
+
37
+ Axlsx::Workbook.send(:include, AxlsxStyler::Workbook)
@@ -1,35 +1,35 @@
1
1
  require_relative './border_creator'
2
2
 
3
3
  module AxlsxStyler
4
- module Axlsx
5
- module Worksheet
6
- # Example to add a single style:
7
- # add_style 'A1:B5', b: true, sz: 14
8
- #
9
- # Example to add multiple styles:
10
- # bold = { b: true }
11
- # large_text = { sz: 30 }
12
- # add_style 'B2:F8', bold, large_text
13
- def add_style(cell_ref, *styles)
14
- item = self[cell_ref]
15
- cells = item.is_a?(Array) ? item : [item]
16
- cells.each do |cell|
17
- styles.each do |style|
18
- cell.add_style(style)
19
- end
4
+ module Worksheet
5
+ # Example to add a single style:
6
+ # add_style 'A1:B5', b: true, sz: 14
7
+ #
8
+ # Example to add multiple styles:
9
+ # bold = { b: true }
10
+ # large_text = { sz: 30 }
11
+ # add_style 'B2:F8', bold, large_text
12
+ def add_style(cell_ref, *styles)
13
+ item = self[cell_ref]
14
+ cells = item.is_a?(Array) ? item : [item]
15
+ cells.each do |cell|
16
+ styles.each do |style|
17
+ cell.add_style(style)
20
18
  end
21
19
  end
20
+ end
22
21
 
23
- # Examples:
24
- # add_border 'B2:F8', [:left, :top], :medium, '00330f'
25
- # add_border 'B2:F8', [:left, :top], :medium
26
- # add_border 'C2:G10', [:top]
27
- # add_border 'C2:G10'
28
- # add_border 'B2:D5', { style: :thick, color: '00330f', edges: [:left, :right] }
29
- def add_border(cell_ref, args = :all)
30
- cells = self[cell_ref]
31
- BorderCreator.new(self, cells, args).draw
32
- end
22
+ # Examples:
23
+ # add_border 'B2:F8', [:left, :top], :medium, '00330f'
24
+ # add_border 'B2:F8', [:left, :top], :medium
25
+ # add_border 'C2:G10', [:top]
26
+ # add_border 'C2:G10'
27
+ # add_border 'B2:D5', { style: :thick, color: '00330f', edges: [:left, :right] }
28
+ def add_border(cell_ref, args = :all)
29
+ cells = self[cell_ref]
30
+ BorderCreator.new(self, cells, args).draw
33
31
  end
34
32
  end
35
33
  end
34
+
35
+ Axlsx::Worksheet.send(:include, AxlsxStyler::Worksheet)