3
###############################################################################
5
# Simple example of merging cells using the Spreadsheet::WriteExcel module
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.
11
# reverse('�'), August 2002, John McNamara, jmcnamara@cpan.org
15
use Spreadsheet::WriteExcel;
17
# Create a new workbook and add a worksheet
18
my $workbook = Spreadsheet::WriteExcel->new("merge2.xls");
19
my $worksheet = $workbook->add_worksheet();
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);
27
# Create a merged format
28
my $format = $workbook->add_format(
36
border_color => 'yellow',
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);