summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2016-05-25 00:24:46 -0400
committerJesse Luehrs <doy@tozt.net>2016-05-25 00:24:46 -0400
commit88153ff1602004d42bf9e8220c8a8d114b591cab (patch)
tree9fb121735e91bbf1d2442a14798fc4ce55499b90
parentb4b720e5322df26689ccc684a78dcb5db924da94 (diff)
downloadspreadsheet-parsexlsx-88153ff1602004d42bf9e8220c8a8d114b591cab.tar.gz
spreadsheet-parsexlsx-88153ff1602004d42bf9e8220c8a8d114b591cab.zip
be more efficient about finding merged cells
-rw-r--r--lib/Spreadsheet/ParseXLSX.pm8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/Spreadsheet/ParseXLSX.pm b/lib/Spreadsheet/ParseXLSX.pm
index a66c4d8..6cf5486 100644
--- a/lib/Spreadsheet/ParseXLSX.pm
+++ b/lib/Spreadsheet/ParseXLSX.pm
@@ -202,7 +202,7 @@ sub _parse_sheet {
$sheet->{MaxCol} = -1;
$sheet->{Selection} = [ 0, 0 ];
- my @merged_cells;
+ my %merged_cells;
my @column_formats;
my @column_widths;
@@ -288,7 +288,7 @@ sub _parse_sheet {
];
for my $row ($toprow .. $bottomrow) {
for my $col ($leftcol .. $rightcol) {
- push(@merged_cells, [$row, $col]);
+ $merged_cells{"$row;$col"} = 1;
}
}
}
@@ -417,9 +417,7 @@ sub _parse_sheet {
my $format_idx = $cell->att('s') || 0;
my $format = $sheet->{_Book}{Format}[$format_idx];
die "unknown format $format_idx" unless $format;
- $format->{Merged} = !!grep {
- $row == $_->[0] && $col == $_->[1]
- } @merged_cells;
+ $format->{Merged} = $merged_cells{"$row;$col"};
# see the list of built-in formats below in _parse_styles
# XXX probably should figure this out from the actual format string,