#!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; # Variables my $file_name = 'switch_report.xls'; my $sheet_title='Traffic Estimations Report -May 2002'; my @array=( ['Switch 1','','above cell blank','456','789'], ['Switch 2','DEF','GHI'] ); #print $1; #my $array_ref=\$1; my $array_ref=\@array; # Create a new Excel workbook my $workbook = Spreadsheet::WriteExcel->new($file_name); # Add a worksheet my $worksheet = $workbook->addworksheet(); $worksheet->fit_to_pages(1,1); $worksheet->set_landscape(); $worksheet->set_margins(.25); # Add formats my $cb_format = $workbook->addformat(); # Add a format my $rotation_format = $workbook->addformat(); # Define Formats # $cb_format $cb_format->set_bold(); $cb_format->set_italic(); $cb_format->set_underline(); $cb_format->set_align('center'); $cb_format->set_size(18); # $rotation_format $rotation_format->set_rotation(2); $rotation_format->set_bold(); $rotation_format->set_align('vcenter'); # Write to the worksheet $worksheet->write(0,1,$sheet_title, $cb_format); $worksheet->merge_cells(0,1,2,29); $worksheet->merge_cells(3,1,3,29); #$worksheet->write_row(11,1,$array_ref); $worksheet->write(4,0,"Day of the month",$rotation_format); $worksheet->merge_cells(4,0,37,0); # write_switch_data my $row = 4; my $col = 1; $worksheet->write_row($row, $col, $array_ref);