diff options
| author | Randy Morgan <[email protected]> | 2012-03-21 01:24:30 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-03-21 01:24:30 +0900 |
| commit | 26a8ad445d84b9dcb9fc36702ec761603a74ee20 (patch) | |
| tree | 170dce67745b8773850519ddf3603017ad820b5b /examples/example.rb | |
| parent | c7d715dea1e3829ea5110ec8bb4388f2633bf92a (diff) | |
| download | caxlsx-26a8ad445d84b9dcb9fc36702ec761603a74ee20.tar.gz caxlsx-26a8ad445d84b9dcb9fc36702ec761603a74ee20.zip | |
adding in an option to disable both the require of RMagick and auto-width processing. see Workbook#use_autowidth. Defaults to true for backward compatibility.
Diffstat (limited to 'examples/example.rb')
| -rw-r--r-- | examples/example.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/example.rb b/examples/example.rb index df5a401f..d834a51c 100644 --- a/examples/example.rb +++ b/examples/example.rb @@ -144,6 +144,18 @@ wb.add_worksheet(:name => "Bar Chart") do |sheet| end end +##Hide Gridlines in chart +wb.add_worksheet(:name => "Chart With No Gridlines") do |sheet| + sheet.add_row ["A Simple Bar Chart"] + sheet.add_row ["First", "Second", "Third"] + sheet.add_row [1, 2, 3] + sheet.add_chart(Axlsx::Bar3DChart, :start_at => "A4", :end_at => "F17") do |chart| + chart.add_series :data => sheet["A3:C3"], :labels => sheet["A2:C2"], :title => sheet["A1"] + chart.valAxis.gridlines = false + chart.catAxis.gridlines = false + end +end + ##Generating A Pie Chart wb.add_worksheet(:name => "Pie Chart") do |sheet| @@ -201,6 +213,13 @@ wb.add_worksheet(:name => "custom column widths") do |sheet| sheet.column_widths nil, 3 end +##Fit to page printing + +wb.add_worksheet(:name => "fit to page") do |sheet| + sheet.add_row ['this all goes on one page'] + sheet.fit_to_page = true +end + ##Hide Gridlines in worksheet wb.add_worksheet(:name => "No Gridlines") do |sheet| @@ -228,6 +247,15 @@ p.use_shared_strings = true p.serialize("shared_strings_example.xlsx") +##Disabling Autowidth +p = Axlsx::Package.new +p.use_autowidth = false +wb = p.workbook +wb.add_worksheet(:name => "No Magick") do | sheet | + sheet.add_row ['oh look! no autowidth - and no magick loaded in your process'] +end +p.validate.each { |e| puts e.message } +p.serialize("no-use_autowidth.xlsx") |
