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

setReadDataOnly function is deprecated or missing #3943

Open
spectoras opened this issue Mar 10, 2024 · 4 comments
Open

setReadDataOnly function is deprecated or missing #3943

spectoras opened this issue Mar 10, 2024 · 4 comments

Comments

@spectoras
Copy link

This is:

- [x ] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

The function should exist didnt found any deprecated issue.

What is the current behavior?

Some numbers like 3.2.11 is read 3 february 2012

Which versions of PhpSpreadsheet and PHP are affected?

Newest i use composer

Iam trying to use setReadDataOnly(true) but vs code writes me its undefined. Iam using composer to install the library and It is working except this function. I try the below code :

$reader = IOFactory::createReader('Xlsx');
$spreadsheet = $reader->load($file['tmp_name']);
$worksheet = $spreadsheet->getSheet(9);
$worksheet->getParent()->setReadDataOnly(true);

@MarkBaker
Copy link
Member

setReadDataOnly() is a method of the Reader, called before you load the spreadsheet. Calling it against the Spreadsheet once you've already loaded it is rather pointless because the purpose of the method is to tell the Reader whether it should load spreadsheet style and structure information or not.

@MarkBaker
Copy link
Member

Some numbers like 3.2.11 is read 3 february 2012

What is 3.2.11? It certainly isn't a number

@spectoras
Copy link
Author

spectoras commented Mar 11, 2024 via email

@MarkBaker
Copy link
Member

If this was an Excel xls or xlsx file, then it should be defined as a string in the file, and treated as such by PhpSpreadsheet.
If it's being treated otherwise, then please provide an example file that will allow us to identify why it is being considered as a date and not as a string.

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