3
###############################################################################
5
# Example of how to use the WriteExcel module to write a basic multiple
6
# worksheet Excel file.
8
# reverse('�'), March 2001, John McNamara, jmcnamara@cpan.org
12
use Spreadsheet::WriteExcel;
14
# Create a new Excel workbook
15
my $workbook = Spreadsheet::WriteExcel->new("regions.xls");
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");
24
my $format = $workbook->add_format();
26
$format->set_color('blue');
28
# Add a caption to each worksheet
29
foreach my $worksheet ($workbook->sheets()) {
30
$worksheet->write(0, 0, "Sales", $format);
34
$north->write(0, 1, 200000);
35
$south->write(0, 1, 100000);
36
$east->write (0, 1, 150000);
37
$west->write (0, 1, 100000);
39
# Set the active worksheet
42
# Set the width of the first column
43
$south->set_column(0, 0, 20);
46
$south->set_selection(0, 1);