doy / spreadsheet-parsexlsx

parse XLSX files
http://metacpan.org/release/Spreadsheet-ParseXLSX
27 stars 35 forks source link

no element found at line 1, column 0, byte -1 #38

Closed nsharrok closed 9 years ago

nsharrok commented 9 years ago

I've got a folder full of .xlsm files to process saves with MS Excel 2010 by a client. On parsing ny of the files I get this error. no element found at line 1, column 0, byte -1 at C:/Perl64/lib/XML/Parser.pm line 187 at C:/Perl64/site/lib/Spreadsheet/ParseXLSX.pm line 224 which is an error reported for line 187 of Parser.pm where $arg is blank $result = $expat->parse($arg); The sub parse is called at line 224 in sub _parse_sheet of ParseXLSX.pm which is called at line 94 in _parse_workbook of ParseXLSX.pm $self->_parse_sheet($sheet, $files->{sheets}{$idx}) I had to add a condition th get the ParseXLSX to work because $files->{sheets}{$idx} can be empty.

$self->_parse_sheet($sheet, $files->{sheets}{$idx}) if $files->{sheets}{$idx};

This works for me. I thought you would be intrested.

Noel Sharrock

doy commented 9 years ago

Can you provide me with a sample file that exhibits this bug?

morungos commented 9 years ago

+1 on this.

I've just come across this and it's very easy to replicate: it's an XLSX file containing a chart sheet, just move a chart to sheet all by itself. I can email you a file if you need one (can't attach them here).

morungos commented 9 years ago

I just made a pull request on it :-) - -and this includes a test file that will replicate it

doy commented 9 years ago

Should be fixed with #43.