lib/write_xlsx/utility.rb in write_xlsx-1.04.0 vs lib/write_xlsx/utility.rb in write_xlsx-1.07.0
- old
+ new
@@ -802,13 +802,13 @@
end
#
# Write the <c:txPr> element.
#
- def write_tx_pr(is_y_axis, font) # :nodoc:
+ def write_tx_pr(font, is_y_axis = nil) # :nodoc:
rotation = nil
- if font && font[:_rotation]
+ if font && font.respond_to?(:[]) && font[:_rotation]
rotation = font[:_rotation]
end
@writer.tag_elements('c:txPr') do
# Write the a:bodyPr element.
write_a_body_pr(rotation, is_y_axis)
@@ -901,10 +901,11 @@
#
# Get the font latin attributes from a font hash.
#
def get_font_latin_attributes(font)
return [] unless font
+ return [] unless font.respond_to?(:[])
attributes = []
attributes << ['typeface', font[:_name]] if ptrue?(font[:_name])
attributes << ['pitchFamily', font[:_pitch_family]] if font[:_pitch_family]
attributes << ['charset', font[:_charset]] if font[:_charset]
@@ -957,9 +958,10 @@
#
# Get the font style attributes from a font hash.
#
def get_font_style_attributes(font)
return [] unless font
+ return [] unless font.respond_to?(:[])
attributes = []
attributes << ['sz', font[:_size]] if ptrue?(font[:_size])
attributes << ['b', font[:_bold]] if font[:_bold]
attributes << ['i', font[:_italic]] if font[:_italic]