An ampersand in the title , the output is broken.

28 views
Skip to first unread message

TAKEHARU NAKAMURA

unread,
Jul 6, 2015, 10:06:21 AM7/6/15
to ax...@googlegroups.com
An ampersand in the title , the output is broken.
like below:

#!ruby

require 'axlsx'

Axlsx::Package.new do |p|
p.workbook.add_worksheet(:name => "Pie Chart") do |sheet|
sheet.add_row ["Simple Pie Chart"]
%w(first second third).each { |label| sheet.add_row [label, rand(24)+1] }
sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0,5], :end_at => [10, 20], :title => "example 3: Pie & Chart",:bar_dir => :col) do |chart|
chart.add_series :data => sheet["B2:B4"], :labels => sheet["A2:A4"], :colors => ['FF0000', '00FF00', '0000FF']
end
end
p.serialize('simple.xlsx')
end
__END__

Do not be a problem in such a fix ?

module Axlsx
class Title
def text=(v)
DataTypeValidator.validate 'Title.text', String, v
@text = v.encode('utf-8',:xml=>:text)
@cell = nil
v
end
def cell=(v)
DataTypeValidator.validate 'Title.text', Cell, v
@cell = v
@text = v.value.to_s.encode('utf-8',:xml=>:text)
v
end
end
end

Reply all
Reply to author
Forward
0 new messages