| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Excel; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
30
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use base qw(Object); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
70
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Array; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
16
|
|
|
7
|
1
|
|
|
1
|
|
10613
|
use Spreadsheet::WriteExcel; |
|
|
1
|
|
|
|
|
125519
|
|
|
|
1
|
|
|
|
|
58
|
|
|
8
|
1
|
|
|
1
|
|
655
|
use Excel::Cell; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
9
|
1
|
|
|
1
|
|
484
|
use Excel::Sheet; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
527
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
|
12
|
0
|
|
|
0
|
0
|
|
my ( $pkg, $sheet_arr ) = @_; |
|
13
|
0
|
|
|
|
|
|
return bless $sheet_arr, $pkg; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub sheet { |
|
17
|
0
|
|
|
0
|
0
|
|
my ( $self, $sheet_num ) = @_; |
|
18
|
0
|
|
|
|
|
|
return $self->[ $sheet_num - 1 ]; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
0
|
|
sub sheets { return Array->new( @{ +shift } ); } |
|
|
0
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub save { |
|
24
|
0
|
|
|
0
|
0
|
|
my ( $self, $to_file ) = @_; |
|
25
|
0
|
0
|
|
|
|
|
unlink $to_file if -e $to_file; |
|
26
|
0
|
|
|
|
|
|
my $workbook = Spreadsheet::WriteExcel->new($to_file); |
|
27
|
|
|
|
|
|
|
$self->sheets->each( |
|
28
|
|
|
|
|
|
|
sub { |
|
29
|
0
|
|
|
0
|
|
|
my ( $sheet, $i ) = @_; |
|
30
|
0
|
|
|
|
|
|
my $worksheet = $workbook->add_worksheet( $sheet->name ); |
|
31
|
0
|
|
|
|
|
|
my @col_width = (); |
|
32
|
0
|
|
|
|
|
|
for my $col ( 1 .. $sheet->col_count ) { |
|
33
|
0
|
|
|
|
|
|
for my $row ( 1 .. $sheet->row_count ) { |
|
34
|
0
|
|
|
|
|
|
my $cell = $sheet->get( $row, $col ); |
|
35
|
0
|
0
|
|
|
|
|
if ($cell) { |
|
36
|
0
|
0
|
0
|
|
|
|
if ( $cell->width > ( $col_width[$col] or 0 ) ) { |
|
37
|
0
|
|
|
|
|
|
$col_width[$col] = $cell->width; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
0
|
|
|
|
|
|
my $value = $cell->value; |
|
40
|
0
|
|
|
|
|
|
my $format = $workbook->add_format(); |
|
41
|
0
|
|
|
|
|
|
$workbook->set_custom_color( |
|
42
|
|
|
|
|
|
|
40, |
|
43
|
|
|
|
|
|
|
'#' |
|
44
|
|
|
|
|
|
|
. uc( |
|
45
|
|
|
|
|
|
|
sprintf( "%.6x", |
|
46
|
|
|
|
|
|
|
$cell->{border_bottom}->{color} ) |
|
47
|
|
|
|
|
|
|
) |
|
48
|
|
|
|
|
|
|
); |
|
49
|
0
|
|
|
|
|
|
$workbook->set_custom_color( |
|
50
|
|
|
|
|
|
|
41, |
|
51
|
|
|
|
|
|
|
'#' |
|
52
|
|
|
|
|
|
|
. uc( |
|
53
|
|
|
|
|
|
|
sprintf( |
|
54
|
|
|
|
|
|
|
"%.6x", $cell->{border_left}->{color} |
|
55
|
|
|
|
|
|
|
) |
|
56
|
|
|
|
|
|
|
) |
|
57
|
|
|
|
|
|
|
); |
|
58
|
0
|
|
|
|
|
|
$format->set_bottom( |
|
59
|
|
|
|
|
|
|
Excel::Cell->english_to_num( |
|
60
|
|
|
|
|
|
|
$cell->{border_bottom}->{width}, |
|
61
|
|
|
|
|
|
|
$cell->{border_bottom}->{style} |
|
62
|
|
|
|
|
|
|
) |
|
63
|
|
|
|
|
|
|
); |
|
64
|
0
|
|
|
|
|
|
$format->set_bottom_color(40); |
|
65
|
0
|
|
|
|
|
|
$format->set_left( |
|
66
|
|
|
|
|
|
|
Excel::Cell->english_to_num( |
|
67
|
|
|
|
|
|
|
$cell->{border_left}->{width}, |
|
68
|
|
|
|
|
|
|
$cell->{border_left}->{style} |
|
69
|
|
|
|
|
|
|
) |
|
70
|
|
|
|
|
|
|
); |
|
71
|
0
|
|
|
|
|
|
$format->set_left_color(41); |
|
72
|
0
|
|
|
|
|
|
$worksheet->write( $row - 1, $col - 1, $value, |
|
73
|
|
|
|
|
|
|
$format ); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
} |
|
77
|
0
|
|
|
|
|
|
for ( my $i = 1 ; $i <= scalar(@col_width) ; $i++ ) { |
|
78
|
0
|
|
|
|
|
|
$worksheet->set_column( $i - 1, $i - 1, $col_width[$i] ); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} |
|
82
|
0
|
|
|
|
|
|
); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |