1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Spreadsheet::ParseXLSX;
my $wb = Spreadsheet::ParseXLSX->new->parse('t/data/bug-10.xlsx');
is($wb->worksheet_count, 4);
{
my @contents = (
[ ['Foo01', 0], ['Bar01', 0] ],
[ ['Foo02', 0], ['Bar02', 0] ],
[ ['Foo03', 0], ['Bar03', 0] ],
[ ['Foo04', 0], ['Bar04', 0] ],
);
my $ws = $wb->worksheet(0);
for my $row (0..$#contents) {
for my $col (0..$#{ $contents[$row] }) {
my $cell = $ws->get_cell($row, $col);
is($cell->value, $contents[$row][$col][0]);
is(!!$cell->is_merged, !!$contents[$row][$col][1]);
}
}
is($ws->get_merged_areas, undef);
}
{
my @contents = (
[ ['Foo01', 0], ['Bar01', 0] ],
[ ['Foo02', 0], ['Bar02', 0] ],
[ ['Foo03', 0], ['Bar03', 0] ],
[ ['Foo04', 1], ['', 1] ],
);
my $ws = $wb->worksheet(1);
for my $row (0..$#contents) {
for my $col (0..$#{ $contents[$row] }) {
my $cell = $ws->get_cell($row, $col);
is($cell->value, $contents[$row][$col][0]);
is(!!$cell->is_merged, !!$contents[$row][$col][1]);
}
}
is_deeply(
$ws->get_merged_areas,
[ [ 3, 0, 3, 1 ] ],
);
}
{
my @contents = (
[ ['Foo01', 0], ['Bar01', 0] ],
[ ['Foo02', 0], ['Bar02', 0] ],
[ ['Foo03', 0], ['Bar03', 1] ],
[ ['Foo04', 0], ['', 1] ],
);
my $ws = $wb->worksheet(2);
for my $row (0..$#contents) {
for my $col (0..$#{ $contents[$row] }) {
my $cell = $ws->get_cell($row, $col);
is($cell->value, $contents[$row][$col][0]);
is(!!$cell->is_merged, !!$contents[$row][$col][1]);
}
}
is_deeply(
$ws->get_merged_areas,
[ [ 2, 1, 3, 1 ] ],
);
}
{
my @contents = (
[ ['Foo01', 0], ['Bar01', 0] ],
[ ['Foo02', 0], ['Bar02', 0] ],
[ ['Foo03', 1], ['', 1] ],
[ ['', 1], ['', 1] ],
[ ['Foo04', 0], ['Bar04', 1] ],
[ ['Foo05', 0], ['', 1] ],
[ ['Foo06', 1], ['', 1] ],
);
my $ws = $wb->worksheet(3);
for my $row (0..$#contents) {
for my $col (0..$#{ $contents[$row] }) {
my $cell = $ws->get_cell($row, $col);
is($cell->value, $contents[$row][$col][0]);
is(!!$cell->is_merged, !!$contents[$row][$col][1]);
}
}
is_deeply(
$ws->get_merged_areas,
[
[ 2, 0, 3, 1 ],
[ 4, 1, 5, 1 ],
[ 6, 0, 6, 1 ],
],
);
}
done_testing;
|