lib/axlsx/stylesheet/styles.rb in axlsx-1.0.17 vs lib/axlsx/stylesheet/styles.rb in axlsx-1.0.18

- old
+ new

@@ -123,15 +123,16 @@ # @return [Integer] # @option options [String] fg_color The text color # @option options [Integer] sz The text size # @option options [Boolean] b Indicates if the text should be bold # @option options [Boolean] i Indicates if the text should be italicised + # @option options [Boolean] u Indicates if the text should be underlined # @option options [Boolean] strike Indicates if the text should be rendered with a strikethrough # @option options [Boolean] strike Indicates if the text should be rendered with a shadow # @option options [Integer] charset The character set to use. # @option options [Integer] family The font family to use. - # @option options [String] name The name of the font 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 [String] bg_color The background color to apply to the cell # @option options [Boolean] hidden Indicates if the cell should be hidden @@ -197,23 +198,24 @@ else options[:num_fmt] || 0 end borderId = options[:border] || 0 + raise ArgumentError, "Invalid borderId" unless borderId < borders.size fill = if options[:bg_color] color = Color.new(:rgb=>options[:bg_color]) pattern = PatternFill.new(:patternType =>:solid, :fgColor=>color) fills << Fill.new(pattern) else 0 end - fontId = if (options.values_at(:fg_color, :sz, :b, :i, :strike, :outline, :shadow, :charset, :family, :font_name).length) + fontId = if (options.values_at(:fg_color, :sz, :b, :i, :u, :strike, :outline, :shadow, :charset, :family, :font_name).length) font = Font.new() - [:b, :i, :strike, :outline, :shadow, :charset, :family, :sz].each { |k| font.send("#{k}=", options[k]) unless options[k].nil? } + [:b, :i, :u, :strike, :outline, :shadow, :charset, :family, :sz].each { |k| font.send("#{k}=", options[k]) unless options[k].nil? } font.color = Color.new(:rgb => options[:fg_color]) unless options[:fg_color].nil? font.name = options[:font_name] unless options[:font_name].nil? fonts << font else 0 @@ -222,9 +224,10 @@ applyProtection = (options[:hidden] || options[:locked]) ? 1 : 0 xf = Xf.new(:fillId => fill, :fontId=>fontId, :applyFill=>1, :applyFont=>1, :numFmtId=>numFmtId, :borderId=>borderId, :applyProtection=>applyProtection) xf.applyNumberFormat = true if xf.numFmtId > 0 + xf.applyBorder = true if borderId > 0 if options[:alignment] xf.alignment = CellAlignment.new(options[:alignment]) end