Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cell coordinate can not be zero-length string #201

Closed
lawmillion opened this issue Aug 19, 2017 · 8 comments
Closed

Cell coordinate can not be zero-length string #201

lawmillion opened this issue Aug 19, 2017 · 8 comments

Comments

@lawmillion
Copy link

I'm import excel ,load file throw this error。
I don't know what to do

@yasar-luo
Copy link
Contributor

You can attach the file, and more description about it.

@lawmillion
Copy link
Author

lawmillion commented Aug 20, 2017

@GreatHumorist http://osia6vire.bkt.clouddn.com/test_excel.xlsx this is excel
$this->reader = IOFactory::createReader('xlsx');
$this->reader->load($this->file);

PhpOffice\PhpSpreadsheet\Exception: Cell coordinate can not be zero-length string in /var/www/laravel/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell.php:603

@yasar-luo
Copy link
Contributor

yasar-luo commented Aug 20, 2017

Hi, I tried to resume this bug, and find out that it's the bug with xml.

As we know, a xlsx type file is a zip file in fact, so I rename and unzip your xlsx file and another xlsx file which can be correctly read by phpSpreadsheet, I found some difference in "./xl/worksheets/sheet1.xml":

Each xml node c in worksheet->sheetData->row is like '' which is correct, but your xml is '', the attribute 'r' is the location of the data, 's' maybe is style, and 't' maybe is type, your node c in worksheet xml only include one attribute. When the phpspreadsheet reader read this xml file, it can't find a 'r' attribute so it reports a error message.

In order to solve this problem, you can try another software to generate this file, or wait me to fix it. Maybe hours later.

Just now I also found that when you merge even just two cell by software like excel, these 'r' attribute will automatic add to the xml file.

@lawmillion
Copy link
Author

@GreatHumorist Hi,I found that can fix files with Excel software,but I hope to fix them with code。
Do not want to operate again,I hope you can fix it,thank you!

@yasar-luo
Copy link
Contributor

I have fixed this bug without strict test, you can update your code and try if it is correct.

If the code is correct or not, pls tell me and give the sample data, I try to fix it again, or pull it.

@lawmillion
Copy link
Author

@GreatHumorist Hi,Thank you,This code is work fine,I hope composer install you fix

@yasar-luo
Copy link
Contributor

Ok, I have pulled request, now is waiting merge. Could you pls give me a follow or star, thank you.

@lawmillion
Copy link
Author

@GreatHumorist My pleasure.

PowerKiKi pushed a commit that referenced this issue Sep 22, 2017
When describing a cell, the cell reference (r="A1") is optional.
When not present, we should just increment the index of the last processed row.

Fixes #201 
Closes #225
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants