PhpSpreadsheet icon indicating copy to clipboard operation
PhpSpreadsheet copied to clipboard

setReadDataOnly function is deprecated or missing

Open spectoras opened this issue 1 year ago • 4 comments

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);

spectoras avatar Mar 10 '24 18:03 spectoras

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 avatar Mar 10 '24 20:03 MarkBaker

Some numbers like 3.2.11 is read 3 february 2012

What is 3.2.11? It certainly isn't a number

MarkBaker avatar Mar 10 '24 20:03 MarkBaker

It should be a string but with or without setreaddataonly it is no use.....it reads it like a date....

Στις Κυρ 10 Μαρ 2024, 10:24 μ.μ. ο χρήστης Mark Baker < @.***> έγραψε:

Some numbers like 3.2.11 is read 3 february 2012

What is 3.2.11? It certainly isn't a number

— Reply to this email directly, view it on GitHub https://github.com/PHPOffice/PhpSpreadsheet/issues/3943#issuecomment-1987351956, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNYROWSHMGCJ3YJVOKSK2TYXS6PTAVCNFSM6AAAAABEPF5VZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGM2TCOJVGY . You are receiving this because you authored the thread.Message ID: @.***>

spectoras avatar Mar 11 '24 17:03 spectoras

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.

MarkBaker avatar Mar 11 '24 21:03 MarkBaker

No update in 5 months, closing.

oleibman avatar Aug 18 '24 07:08 oleibman