summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2015-03-15 00:58:54 -0400
committerJesse Luehrs <doy@tozt.net>2015-03-15 00:58:54 -0400
commit39d4f196204cd8db8f462cd5405f811505f561c0 (patch)
treef4ddd6b8aa0f721e61af197dbee780d6b651c0d6
parentcf65e27c62d53f0097851b76e29b659df366b08a (diff)
downloadspreadsheet-parsexlsx-39d4f196204cd8db8f462cd5405f811505f561c0.tar.gz
spreadsheet-parsexlsx-39d4f196204cd8db8f462cd5405f811505f561c0.zip
handle other valid booleans for diagonalDown and diagonalUp
the spec allows for 1/0/true/false, so need to make sure they're all handled
-rw-r--r--lib/Spreadsheet/ParseXLSX.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Spreadsheet/ParseXLSX.pm b/lib/Spreadsheet/ParseXLSX.pm
index ac33514..619ba3c 100644
--- a/lib/Spreadsheet/ParseXLSX.pm
+++ b/lib/Spreadsheet/ParseXLSX.pm
@@ -493,6 +493,12 @@ sub _parse_styles {
my @borders = map {
my $border = $_;
+ my ($ddiag, $udiag) = map {
+ my $v = $border->att($_) // 0;
+ $v = 1 if $v eq 'true';
+ $v = 0 if $v eq 'false';
+ $v
+ } qw(diagonalDown diagonalUp);
# XXX specs say "begin" and "end" rather than "left" and "right",
# but... that's not what seems to be in the file itself (sigh)
{
@@ -510,8 +516,11 @@ sub _parse_styles {
} qw(left right top bottom)
],
diagonal => [
- ($border->att('diagonalDown') // 0) * 2 + ($border->att('diagonalUp') // 0),
- $border{ $border->first_child('diagonal')->att('style') || 'none' },
+ ( $ddiag && $udiag ? 3
+ : $ddiag && !$udiag ? 2
+ : !$ddiag && $udiag ? 1
+ : 0),
+ $border{$border->first_child('diagonal')->att('style') || 'none'},
$self->_color(
$workbook->{Color},
$border->first_child('diagonal')->first_child('color')