summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-10-09 09:57:32 -0400
committerJesse Luehrs <doy@tozt.net>2013-10-09 09:57:32 -0400
commit8fc846b02f32f0f701525e356f6544958cd0d43d (patch)
tree2ca063891d151f77c92cc8eb56ac3eb38beb9387
parent852d8eaa132ed1cb10a55ff3bbf9ca82e52f8867 (diff)
downloadspreadsheet-parsexlsx-8fc846b02f32f0f701525e356f6544958cd0d43d.tar.gz
spreadsheet-parsexlsx-8fc846b02f32f0f701525e356f6544958cd0d43d.zip
support worksheets with a range selection
-rw-r--r--lib/Spreadsheet/ParseXLSX.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Spreadsheet/ParseXLSX.pm b/lib/Spreadsheet/ParseXLSX.pm
index e202ccb..4f28376 100644
--- a/lib/Spreadsheet/ParseXLSX.pm
+++ b/lib/Spreadsheet/ParseXLSX.pm
@@ -237,8 +237,16 @@ sub _parse_sheet {
my ($selection) = $sheet_xml->find_nodes('//selection');
if ($selection) {
- my $cell = $selection->att('activeCell');
- $sheet->{Selection} = [ $self->_cell_to_row_col($cell) ];
+ if (my $cell = $selection->att('activeCell')) {
+ $sheet->{Selection} = [ $self->_cell_to_row_col($cell) ];
+ }
+ elsif (my $range = $selection->att('sqref')) {
+ my ($topleft, $bottomright) = $range =~ /([^:]+):([^:]+)/;
+ $sheet->{Selection} = [
+ $self->_cell_to_row_col($topleft),
+ $self->_cell_to_row_col($bottomright),
+ ];
+ }
}
else {
$sheet->{Selection} = [ 0, 0 ];