summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xexamples/example.rb2
-rw-r--r--lib/axlsx/stylesheet/styles.rb6
2 files changed, 6 insertions, 2 deletions
diff --git a/examples/example.rb b/examples/example.rb
index 6f4daec3..3af276d5 100755
--- a/examples/example.rb
+++ b/examples/example.rb
@@ -309,7 +309,7 @@ end
##Tables
#```ruby
-wb.add_worksheet(:name => "Table") do |sheet|
+wb.add_worksheet(:name => "Table", :style_info => { :name => "TableStyleMedium23" }) do |sheet|
sheet.add_row ["Build Matrix"]
sheet.add_row ["Build", "Duration", "Finished", "Rvm"]
sheet.add_row ["19.1", "1 min 32 sec", "about 10 hours ago", "1.8.7"]
diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb
index fd956a8c..240d86fa 100644
--- a/lib/axlsx/stylesheet/styles.rb
+++ b/lib/axlsx/stylesheet/styles.rb
@@ -279,7 +279,11 @@ module Axlsx
# @return [Font|Integer]
def parse_font_options(options={})
return if (options.keys & [:fg_color, :sz, :b, :i, :u, :strike, :outline, :shadow, :charset, :family, :font_name]).empty?
- font = Font.new(fonts.first.instance_values.merge(options))
+ fonts.first.instance_values.each do |key, value|
+ # Thanks for that 1.8.7 - cant do a simple merge...
+ options[key.to_sym] = value unless options.keys.include?(key.to_sym)
+ end
+ font = Font.new(options)
font.color = Color.new(:rgb => options[:fg_color]) if options[:fg_color]
font.name = options[:font_name] if options[:font_name]
options[:type] == :dxf ? font : fonts << font