~ubuntu-branches/ubuntu/intrepid/horae/intrepid

« back to all changes in this revision

Viewing changes to 0CPAN/Spreadsheet-WriteExcel-2.15/examples/repeat.pl

  • Committer: Bazaar Package Importer
  • Author(s): Carlo Segre
  • Date: 2008-02-23 23:13:02 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080223231302-mnyyxs3icvrus4ke
Tags: 066-3
Apply patch to athena_parts/misc.pl for compatibility with 
perl-tk 804.28.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl -w
2
 
 
3
 
######################################################################
4
 
#
5
 
# Example of writing repeated formulas.
6
 
#
7
 
# reverse('�'), August 2002, John McNamara, jmcnamara@cpan.org
8
 
#
9
 
 
10
 
use strict;
11
 
use Spreadsheet::WriteExcel;
12
 
 
13
 
my $workbook  = Spreadsheet::WriteExcel->new("repeat.xls");
14
 
my $worksheet = $workbook->add_worksheet();
15
 
 
16
 
 
17
 
my $limit = 1000;
18
 
 
19
 
# Write a column of numbers
20
 
for my $row (0..$limit) {
21
 
    $worksheet->write($row, 0,  $row);
22
 
}
23
 
 
24
 
 
25
 
# Store a formula
26
 
my $formula = $worksheet->store_formula('=A1*5+4');
27
 
 
28
 
 
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));
32
 
}
33
 
 
34
 
 
35
 
# Direct formula writing. As a speed comparison uncomment the
36
 
# following and run the program again
37
 
 
38
 
#for my $row (0..$limit) {
39
 
#    $worksheet->write_formula($row, 2, '=A'.($row+1).'*5+4');
40
 
#}
41
 
 
42
 
 
43
 
 
44
 
__END__
45