lib/write_xlsx/chart.rb in write_xlsx-0.65.1 vs lib/write_xlsx/chart.rb in write_xlsx-0.69.0

- old
+ new

@@ -1788,16 +1788,22 @@ :_bold => params[:bold], :_italic => params[:italic], :_underline => params[:underline], :_pitch_family => params[:pitch_family], :_charset => params[:charset], - :_baseline => params[:baseline] || 0 + :_baseline => params[:baseline] || 0, + :_rotation => params[:rotation] } # Convert font size units. font[:_size] *= 100 if font[:_size] && font[:_size] != 0 + # Convert rotation into 60,000ths of a degree. + if ptrue?(font[:_rotation]) + font[:_rotation] = 60_000 * font[:_rotation].to_i + end + font end # # Convert user defined line properties to the structure required internally. @@ -3426,10 +3432,22 @@ @writer.empty_tag('a:bodyPr', attributes) end # + # Write the <a:bodyPr> element for axis fonts. + # + def write_axis_body_pr(rot = nil, vert = nil) + attributes = [] + + attributes << 'rot' << rot if rot + attributes << 'vert' << vert if vert + + @writer.empty_tag('a:bodyPr', attributes) + end + + # # Write the <a:lstStyle> element. # def write_a_lst_style # :nodoc: @writer.empty_tag('a:lstStyle') end @@ -3987,10 +4005,10 @@ # def write_axis_font(font) # :nodoc: return unless font @writer.tag_elements('c:txPr') do - @writer.empty_tag('a:bodyPr') + write_axis_body_pr(font[:_rotation]) write_a_lst_style @writer.tag_elements('a:p') do write_a_p_pr_rich(font) write_a_end_para_rpr end