summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xexamples/example.rb5
-rw-r--r--lib/axlsx/stylesheet/styles.rb7
2 files changed, 9 insertions, 3 deletions
diff --git a/examples/example.rb b/examples/example.rb
index eb9d1a15..6f4daec3 100755
--- a/examples/example.rb
+++ b/examples/example.rb
@@ -62,8 +62,8 @@ end
#```ruby
#Axlsx defines a thin border style, but you can easily create and use your own.
wb.styles do |s|
- red_border = s.add_style :border => { :style => :thick, :color =>"FFFF0000" }
- blue_border = s.add_style :border => { :style => :thick, :color =>"FF0000FF" }
+ red_border = s.add_style :border => { :style => :thick, :color =>"FFFF0000", :edges => [:left, :right] }
+ blue_border = s.add_style :border => { :style => :thick, :color =>"FF0000FF"}
wb.add_worksheet(:name => "Custom Borders") do |sheet|
sheet.add_row ["wrap", "me", "Up in Red"], :style => red_border
@@ -195,6 +195,7 @@ end
##Automatic cell types
+
#```ruby
wb.add_worksheet(:name => "Automatic cell types") do |sheet|
date_format = wb.styles.add_style :format_code => 'YYYY-MM-DD'
diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb
index 1b22bb81..0532af66 100644
--- a/lib/axlsx/stylesheet/styles.rb
+++ b/lib/axlsx/stylesheet/styles.rb
@@ -135,6 +135,7 @@ module Axlsx
# @option options [Integer] num_fmt The number format to apply
# @option options [String] format_code The formatting to apply.
# @option options [Integer|Hash] border The border style to use.
+ # borders support style, color and edges options @see parse_border_options
# @option options [String] bg_color The background color to apply to the cell
# @option options [Boolean] hidden Indicates if the cell should be hidden
# @option options [Boolean] locked Indicates if the cell should be locked
@@ -298,7 +299,11 @@ module Axlsx
# parses Style#add_style options for borders.
# @note noop if :border is not specified in options
- # @option options [Hash|Integer] A border style definition hash or the index of an existing border. Border style definition hashes must include :style and color: key-value entries and may include an :edges entry that references an array of symbols identifying which border edges you wish to apply the style or any other valid Border initializer options. If the :edges entity is not provided the style is applied to all edges of cells that reference this style.
+ # @option options [Hash|Integer] A border style definition hash or the index of an existing border.
+ # Border style definition hashes must include :style and :color key-value entries and
+ # may include an :edges entry that references an array of symbols identifying which border edges
+ # you wish to apply the style or any other valid Border initializer options.
+ # If the :edges entity is not provided the style is applied to all edges of cells that reference this style.
# @example
# #apply a thick red border to the top and bottom
# { :border => { :style => :thick, :color => "FFFF0000", :edges => [:top, :bottom] }