Sha256: 3c84a4cce17102f9eefb573a108af5cf3630ad835ebe42792ca1f224b1244748

Contents?: true

Size: 1.06 KB

Versions: 33

Compression:

Stored size: 1.06 KB

Contents

#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
#
# Example of how to use the WriteExcel module to write text and numbers
# to an Excel binary file.
#
# reverse('©'), March 2001, John McNamara, jmcnamara@cpan.org
#
# original written in Perl by John McNamara
# converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
#
require 'rubygems'
require 'writeexcel'

# Create a new workbook called simple.xls and add a worksheet
workbook  = WriteExcel.new('a_simple.xls');
worksheet = workbook.add_worksheet

# The general syntax is write(row, column, token). Note that row and
# column are zero indexed
#

# Write some text
worksheet.write(0, 0,  "Hi Excel!")


# Write some numbers
worksheet.write(2, 0,  3)          # Writes 3
worksheet.write(3, 0,  3.00000)    # Writes 3
worksheet.write(4, 0,  3.00001)    # Writes 3.00001
worksheet.write(5, 0,  3.14159)    # TeX revision no.?


# Write some formulas
worksheet.write(7, 0,  '=A3 + A6')
worksheet.write(8, 0,  '=IF(A5>3,"Yes", "No")')


# Write a hyperlink
worksheet.write(10, 0, 'http://www.perl.com/')

# File save
workbook.close

Version data entries

33 entries across 33 versions & 3 rubygems

Version Path
writeexcel-1.0.4 examples/a_simple.rb
writeexcel-1.0.3 examples/a_simple.rb
writeexcel-1.0.2 examples/a_simple.rb
writeexcel-1.0.1 examples/a_simple.rb
writeexcel-1.0.0 examples/a_simple.rb
writeexcel-0.6.19 examples/a_simple.rb
writeexcel-0.6.18 examples/a_simple.rb
writeexcel-0.6.17 examples/a_simple.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.16/examples/a_simple.rb
writeexcel-0.6.16 examples/a_simple.rb
writeexcel-0.6.15 examples/a_simple.rb
writeexcel-0.6.14 examples/a_simple.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/examples/a_simple.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/examples/a_simple.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/examples/a_simple.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/examples/a_simple.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/examples/a_simple.rb
writeexcel-0.6.13 examples/a_simple.rb
ricardoo27-writeexcel-0.6.12.2 examples/a_simple.rb
ricardoo27-writeexcel-0.6.12.1 examples/a_simple.rb