~ubuntu-branches/ubuntu/gutsy/horae/gutsy

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Carlo Segre
  • Date: 2006-12-28 12:36:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061228123648-9xnjr76wfthd92cq
Tags: 064-1
New upstream release, dropped dependency on libtk-filedialog-perl.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl -w
2
 
 
3
 
###############################################################################
4
 
#
5
 
# Example of how to use the WriteExcel module to write a basic multiple
6
 
# worksheet Excel file.
7
 
#
8
 
# reverse('�'), March 2001, John McNamara, jmcnamara@cpan.org
9
 
#
10
 
 
11
 
use strict;
12
 
use Spreadsheet::WriteExcel;
13
 
 
14
 
# Create a new Excel workbook
15
 
my $workbook = Spreadsheet::WriteExcel->new("regions.xls");
16
 
 
17
 
# Add some worksheets
18
 
my $north = $workbook->add_worksheet("North");
19
 
my $south = $workbook->add_worksheet("South");
20
 
my $east  = $workbook->add_worksheet("East");
21
 
my $west  = $workbook->add_worksheet("West");
22
 
 
23
 
# Add a Format
24
 
my $format = $workbook->add_format();
25
 
$format->set_bold();
26
 
$format->set_color('blue');
27
 
 
28
 
# Add a caption to each worksheet
29
 
foreach my $worksheet ($workbook->sheets()) {
30
 
    $worksheet->write(0, 0, "Sales", $format);
31
 
}
32
 
 
33
 
# Write some data
34
 
$north->write(0, 1, 200000);
35
 
$south->write(0, 1, 100000);
36
 
$east->write (0, 1, 150000);
37
 
$west->write (0, 1, 100000);
38
 
 
39
 
# Set the active worksheet
40
 
$south->activate();
41
 
 
42
 
# Set the width of the first column
43
 
$south->set_column(0, 0, 20);
44
 
 
45
 
# Set the active cell
46
 
$south->set_selection(0, 1);