Sha256: 97b0d81125c16e1f8fd490b0e5401e9d2ca67cdebaa3d4322d9617899947621e

Contents?: true

Size: 992 Bytes

Versions: 38

Compression:

Stored size: 992 Bytes

Contents

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

#######################################################################
#
# Example of how to write Spreadsheet::WriteExcel formulas with a user
# specified result.
#
# This is generally only required when writing a spreadsheet for an
# application other than Excel where the formula isn't evaluated.
#
# reverse('©'), August 2005, 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('formula_result.xls')
worksheet = workbook.add_worksheet()
format    = workbook.add_format(:color => 'blue')

worksheet.write('A1', '=1+2')
worksheet.write('A2', '=1+2',                     format, 4)
worksheet.write('A3', '="ABC"',                   nil,    'DEF')
worksheet.write('A4', '=IF(A1 > 1, TRUE, FALSE)', nil,    'TRUE')
worksheet.write('A5', '=1/0',                     nil,    '#DIV/0!')

workbook.close

Version data entries

38 entries across 38 versions & 3 rubygems

Version Path
writeexcel-1.0.9 examples/formula_result.rb
writeexcel-1.0.8 examples/formula_result.rb
writeexcel-1.0.7 examples/formula_result.rb
writeexcel-1.0.6 examples/formula_result.rb
writeexcel-1.0.5 examples/formula_result.rb
writeexcel-1.0.4 examples/formula_result.rb
writeexcel-1.0.3 examples/formula_result.rb
writeexcel-1.0.2 examples/formula_result.rb
writeexcel-1.0.1 examples/formula_result.rb
writeexcel-1.0.0 examples/formula_result.rb
writeexcel-0.6.19 examples/formula_result.rb
writeexcel-0.6.18 examples/formula_result.rb
writeexcel-0.6.17 examples/formula_result.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.16/examples/formula_result.rb
writeexcel-0.6.16 examples/formula_result.rb
writeexcel-0.6.15 examples/formula_result.rb
writeexcel-0.6.14 examples/formula_result.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/examples/formula_result.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/examples/formula_result.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/examples/formula_result.rb