Method: Axlsx::Styles#parse_border_options
- Defined in:
- lib/axlsx/stylesheet/styles.rb
#parse_border_options(options = {}) ⇒ Border|Integer
Note:
noop if :border is not specified in options
parses Style#add_style options for borders.
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/axlsx/stylesheet/styles.rb', line 306 def (={}) return unless [:border] b_opts = [:border] if b_opts.is_a?(Hash) raise ArgumentError, (ERR_INVALID_BORDER_OPTIONS % b_opts) unless b_opts.values_at(:style, :color).size == 2 border = Border.new b_opts (b_opts[:edges] || [:left, :right, :top, :bottom]).each do |edge| = { :name => edge, :style => b_opts[:style], :color => Color.new(:rgb => b_opts[:color]) } border.prs << BorderPr.new() end [:type] == :dxf ? border : borders << border elsif b_opts.is_a? Integer raise ArgumentError, (ERR_INVALID_BORDER_ID % b_opts) unless b_opts < borders.size if [:type] == :dxf borders[b_opts].clone else border = b_opts end end end |