~ubuntu-branches/ubuntu/jaunty/horae/jaunty

« back to all changes in this revision

Viewing changes to 0CPAN/Spreadsheet-WriteExcel-2.15/examples/merge2.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
 
# Simple example of merging cells using the Spreadsheet::WriteExcel module
6
 
#
7
 
# This merges two formatted cells using the "Centre Across Selection" alignment.
8
 
# This was the Excel 5 method of achieving a merge. Use the merge_range()
9
 
# worksheet method instead. See merge3.pl - merge4.pl.
10
 
##
11
 
# reverse('�'), August 2002, John McNamara, jmcnamara@cpan.org
12
 
#
13
 
 
14
 
use strict;
15
 
use Spreadsheet::WriteExcel;
16
 
 
17
 
# Create a new workbook and add a worksheet
18
 
my $workbook  = Spreadsheet::WriteExcel->new("merge2.xls");
19
 
my $worksheet = $workbook->add_worksheet();
20
 
 
21
 
 
22
 
# Increase the cell size of the merged cells to highlight the formatting.
23
 
$worksheet->set_column(1, 2, 30);
24
 
$worksheet->set_row(2, 40);
25
 
 
26
 
 
27
 
# Create a merged format
28
 
my $format = $workbook->add_format(
29
 
                                        merge        => 1,
30
 
                                        bold         => 1,
31
 
                                        size         => 15,
32
 
                                        pattern      => 1,
33
 
                                        border       => 6,
34
 
                                        color        => 'white',
35
 
                                        fg_color     => 'green',
36
 
                                        border_color => 'yellow',
37
 
                                        align        => 'vcenter',
38
 
                                  );
39
 
 
40
 
 
41
 
# Only one cell should contain text, the others should be blank.
42
 
$worksheet->write      (2, 1, "Center across selection", $format);
43
 
$worksheet->write_blank(2, 2,                 $format);
44