diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-07-29 19:15:48 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-07-29 19:15:48 -0400 |
commit | 8a787698efd28a9bec64b1e5d13a4670b1bc1779 (patch) | |
tree | d0f37f37da1185c67a1ca092996660ee72257278 /lib/Spreadsheet/ParseXLSX.pm | |
parent | 9b7271ba5e7628d5cbf26f603435b708575edc1c (diff) | |
download | spreadsheet-parsexlsx-8a787698efd28a9bec64b1e5d13a4670b1bc1779.tar.gz spreadsheet-parsexlsx-8a787698efd28a9bec64b1e5d13a4670b1bc1779.zip |
fix spreadsheets that have only a single cell (#2)
Diffstat (limited to 'lib/Spreadsheet/ParseXLSX.pm')
-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) = @_; |