diff options
Diffstat (limited to 'lib/Spreadsheet')
-rw-r--r-- | lib/Spreadsheet/ParseXLSX.pm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/Spreadsheet/ParseXLSX.pm b/lib/Spreadsheet/ParseXLSX.pm index d96d275..055bcba 100644 --- a/lib/Spreadsheet/ParseXLSX.pm +++ b/lib/Spreadsheet/ParseXLSX.pm @@ -126,9 +126,9 @@ sub _parse_sheet { # XXX need a fallback here, the dimension tag is optional my ($dimension) = $sheet_xml->find_nodes('//dimension'); - my ($topleft, $bottomright) = split ':', $dimension->att('ref'); - my ($rmin, $cmin) = $self->_cell_to_row_col($topleft); - my ($rmax, $cmax) = $self->_cell_to_row_col($bottomright); + my ($rmin, $cmin, $rmax, $cmax) = $self->_dimensions( + $dimension->att('ref') + ); $sheet->{MinRow} = $rmin; $sheet->{MinCol} = $cmin; @@ -552,6 +552,19 @@ sub _base_path_for { return join('/', @path) . '/'; } +sub _dimensions { + my $self = shift; + my ($dim) = @_; + + my ($topleft, $bottomright) = split ':', $dim; + $bottomright = $topleft unless defined $bottomright; + + my ($rmin, $cmin) = $self->_cell_to_row_col($topleft); + my ($rmax, $cmax) = $self->_cell_to_row_col($bottomright); + + return ($rmin, $cmin, $rmax, $cmax); +} + sub _cell_to_row_col { my $self = shift; my ($cell) = @_; |