Sha256: 5cf8604170da1d8c84fb318846ded71f6ef59c4d0e4112e07fd6be20ebf934be

Contents?: true

Size: 1.31 KB

Versions: 38

Compression:

Stored size: 1.31 KB

Contents

#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-

###############################################################################
#
# Simple example of how to add an externally created chart to a Spreadsheet::
# WriteExcel file.
#
#
# This example adds a line chart extracted from the file Chart1.xls as follows:
#
#   perl chartex.pl -c=demo1 Chart1.xls
#
#
# reverse('ゥ'), September 2004, John McNamara, jmcnamara@cpan.org
#
# original written in Perl by John McNamara
# converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
#

require 'writeexcel'

workbook  = WriteExcel.new("demo1.xls")
worksheet = workbook.add_worksheet

# Add the chart extracted using the chartex utility
chart     = workbook.add_chart_ext('demo101.bin', 'Chart1')

# Link the chart to the worksheet data using a dummy formula.
worksheet.store_formula('=Sheet1!A1')

# Add some extra formats to cover formats used in the charts.
chart_font_1 = workbook.add_format(:font_only => 1)
chart_font_2 = workbook.add_format(:font_only => 1)
chart_font_3 = workbook.add_format(:font_only => 1)

# Add all other formats (if any).

# Add data to range that the chart refers to.
nums    = [0, 1, 2, 3, 4,  5,  6,  7,  8,  9,  10 ]
squares = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

worksheet.write_col('A1', nums   )
worksheet.write_col('B1', squares)

workbook.close

Version data entries

38 entries across 38 versions & 3 rubygems

Version Path
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/charts/demo1.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/charts/demo1.rb
writeexcel-0.6.13 charts/demo1.rb
ricardoo27-writeexcel-0.6.12.2 charts/demo1.rb
ricardoo27-writeexcel-0.6.12.1 charts/demo1.rb
writeexcel-0.6.12 charts/demo1.rb
writeexcel-0.6.11 charts/demo1.rb
writeexcel-0.6.10 charts/demo1.rb
writeexcel-0.6.9 charts/demo1.rb
writeexcel-0.6.8 charts/demo1.rb
writeexcel-0.6.7 charts/demo1.rb
writeexcel-0.6.6 charts/demo1.rb
writeexcel-0.6.5 charts/demo1.rb
writeexcel-0.6.4 charts/demo1.rb
writeexcel-0.6.3 charts/demo1.rb
writeexcel-0.6.2 charts/demo1.rb
writeexcel-0.6.1 charts/demo1.rb
writeexcel-0.6.0 charts/demo1.rb