lib/axlsx/stylesheet/styles.rb in axlsx-1.1.0 vs lib/axlsx/stylesheet/styles.rb in axlsx-1.1.1

- old
+ new

@@ -131,11 +131,11 @@ # @option options [Integer] charset The character set to use. # @option options [Integer] family The font family to use. # @option options [String] font_name The name of the font to use # @option options [Integer] num_fmt The number format to apply # @option options [String] format_code The formatting to apply. If this is specified, num_fmt is ignored. - # @option options [Integer] border The border style to use. + # @option options [Integer|Hash] border The border style to use. # @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 # @option options [Hash] alignment A hash defining any of the attributes used in CellAlignment # @see CellAlignment @@ -202,13 +202,15 @@ borderId = options[:border] || 0 if borderId.is_a?(Hash) raise ArgumentError, "border hash definitions must include both style and color" unless borderId.keys.include?(:style) && borderId.keys.include?(:color) - s = borderId.delete :style - c = borderId.delete :color + s = borderId[:style] + c = borderId[:color] + edges = borderId[:edges] || [:left, :right, :top, :bottom] + border = Border.new - [:left, :right, :top, :bottom].each {|pr| border.prs << BorderPr.new(:name => pr, :style=>s, :color => Color.new(:rgb => c))} + edges.each {|pr| border.prs << BorderPr.new(:name => pr, :style=>s, :color => Color.new(:rgb => c))} borderId = self.borders << border end raise ArgumentError, "Invalid borderId" unless borderId < borders.size