3
######################################################################
5
# Example of writing repeated formulas.
7
# reverse('�'), August 2002, John McNamara, jmcnamara@cpan.org
11
use Spreadsheet::WriteExcel;
13
my $workbook = Spreadsheet::WriteExcel->new("repeat.xls");
14
my $worksheet = $workbook->add_worksheet();
19
# Write a column of numbers
20
for my $row (0..$limit) {
21
$worksheet->write($row, 0, $row);
26
my $formula = $worksheet->store_formula('=A1*5+4');
29
# Write a column of formulas based on the stored formula
30
for my $row (0..$limit) {
31
$worksheet->repeat_formula($row, 1, $formula, undef, 'A1', 'A'.($row+1));
35
# Direct formula writing. As a speed comparison uncomment the
36
# following and run the program again
38
#for my $row (0..$limit) {
39
# $worksheet->write_formula($row, 2, '=A'.($row+1).'*5+4');