HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/doc/libspreadsheet-writeexcel-perl/examples/formula_result.pl
#!/usr/bin/perl -w

#######################################################################
#
# 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
#

use strict;
use Spreadsheet::WriteExcel;

my $workbook  = Spreadsheet::WriteExcel->new('formula_result.xls');
my $worksheet = $workbook->add_worksheet();
my $format    = $workbook->add_format(color => 'blue');


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


__END__