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 content ending by zeros (0) #295

Closed
joffreycarle opened this issue Dec 17, 2014 · 3 comments
Closed

Cell content ending by zeros (0) #295

joffreycarle opened this issue Dec 17, 2014 · 3 comments

Comments

@joffreycarle
Copy link

Hello,
I'm using Laravel-Excel to extract data from several xlsx files.
In those files, there are many columns containing data like : " TEST00" or "TES00".
But when I'm retrieving it from Laravel, I can only get "TEST" or "TES", I can't get the full value.

How to force Laravel-Excel to get the full value without having to specify the column type ?

Here is the part of my code used to extract those cells :

Excel::batch($this->_path, function($rows){
            $rows->each(function($row){
                foreach($row->all() as $row_case){
                    if($row_case instanceof \Maatwebsite\Excel\Collections\CellCollection){

                        foreach($row_case->all() as $item_key => $item_value){

                            if($item_value instanceof Carbon){
                                continue;
                            }

                            if(!isset($this->_parameters[$item_key])){
                                Session::flash('error', 'BLABLABLA');
                                return false;
                            }

                            if(preg_match($this->_parameters[$item_key], $item_value)){
                                continue;
                            } else {
                                Session::flash('error', 'BLABLABLA');
                                return false;
                            }

                        }
                    }
                }
            });
@MaatwebsiteSupport
Copy link
Contributor

Based on this commit #153 it should be fixed a while back. I'll have a look soon why this case doesn't work then :)

@joffreycarle
Copy link
Author

Thank you for having a look at it.
I do really need this issue to be resolved as soon as possible so I looked inside the library and I've found in the load function that cells content is loaded correctly, I'm still looking deeper to find where the problem occurs accordingly to the following screen capture.

capture

Those values are contained in the $sharedStrings array.

@MaatwebsiteSupport
Copy link
Contributor

Fixed on the failing test I've added. Fix will be present in the 1.3.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants