From 51d4118966d1c89a52a9d04ebede6e60dd26afe9 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Wed, 26 Sep 2012 22:49:09 +0900 Subject: update readme to show clear example of use_shared_strings for Numbers --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ed421766..8aedaec4 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,23 @@ related to themes, which axlsx does not implement at this time. - border colors do not work 3. Numbers - - you must set 'use_shared_strings' to true + - you must set 'use_shared_strings' to true. This is most + conveniently done just before rendering by calling Package.use_shared_strings = true prior to serialization. + +```ruby +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::Pie3DChart, :start_at => [0,5], :end_at => [10, 20], :title => "example 3: Pie Chart") do |chart| + chart.add_series :data => sheet["B2:B4"], :labels => sheet["A2:A4"], :colors => ['FF0000', '00FF00', '0000FF'] + end + end + p.use_shared_strings = true + p.serialize('simple.xlsx') +end +``` + - charts do not render -- cgit v1.2.3