lib/axlsx/stylesheet/styles.rb in axlsx-1.3.6 vs lib/axlsx/stylesheet/styles.rb in axlsx-2.0.0

- old
+ new

@@ -181,11 +181,11 @@ # # currency = ws.style.add_style(:format_code=>"¥#,##0;[Red]¥-#,##0", # :border=>Axlsx::STYLE_THIN_BORDER) # # # build your rows - # ws.add_row ["Genreated At:", Time.now], :styles=>[nil, date_time] + # ws.add_row ["Generated At:", Time.now], :styles=>[nil, date_time] # ws.add_row ["Previous Year Quarterly Profits (JPY)"], :style=>title # ws.add_row ["Quarter", "Profit", "% of Total"], :style=>title # ws.add_row ["Q1", 4000, 40], :style=>[title, currency, percent] # ws.add_row ["Q2", 3000, 30], :style=>[title, currency, percent] # ws.add_row ["Q3", 1000, 10], :style=>[title, currency, percent] @@ -294,12 +294,14 @@ # @option options [String] bg_color The rgb color to apply to the fill # @return [Fill|Integer] def parse_fill_options(options={}) return unless options[:bg_color] color = Color.new(:rgb=>options[:bg_color]) - pattern = PatternFill.new(:patternType =>:solid, :fgColor=>color) + dxf = options[:type] == :dxf + color_key = dxf ? :bgColor : :fgColor + pattern = PatternFill.new(:patternType =>:solid, color_key=>color) fill = Fill.new(pattern) - options[:type] == :dxf ? fill : fills << fill + dxf ? fill : fills << fill end # 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.