-
-
Notifications
You must be signed in to change notification settings - Fork 637
Reader doesn't understand which is the last column (ODS file) #561
Comments
@eugenio11 Yes - please provide the file in an anonymized form if possible |
Hello, here is the file |
Hi @eugenio11 ! Here is what the content file of the ODS looks like:
The last This is the part that should be modified: spout/src/Spout/Reader/ODS/RowIterator.php Line 245 in 0481054
|
Hello and thanks for the reply. |
Some softwares do add this repeated columns cell for some reasons. Some versions of Excel for instance add this. I'm not sure why... I'm gonna look at the official specs to see what we should do in this case. Eventually, we could have something a bit magic: if the last cell is empty and repeated more than X times, then do not add it; X being a magic number to be determined. This approach should solve 99% of the use cases and be the cause of bugs in the 1% of cases where the last cell is actually repeated a lot on purpose. |
You can reproduce such a file by applying a format to the entire row. Even though only the first cell contains data - LibreOffice at least - will consider the rest of the cells as not empty. |
Hello, |
I would favor introducing the concept of a spreadsheet header or a reader range to Spout.
This would probably not work in some use cases, where there is no header and the range is not known. For us - this would solve issues like this. We always use a headerline to define the spreadsheet. I feel weird about introducing magic number setters to circumvent vendor quirks. |
So, I looked at the specs but there's nothing regarding what the behavior should be. This means that a table-cell with 1023 repeated columns actually represents 1024 cells! So @eugenio11, I'm afraid we can't fix this behavior for now. I guess if you know that your spreadsheet is very small, you can store all the data in memory and do the counting of max num columns yourself to find the actual dimensions of the spreadsheet. @madflow I like your suggestion about using the range (and probably defaulting the start column to 0). If you can change that even after the reading started, one could read the header, count its number of columns and set the range. That way, there's no need to have specific code to handle header row. |
@adrilo thanks for the info; I guess we can implement the "magic number" feature on our side without reading the entire spreadsheet, just the first (or the second, if the first defines labels) row. |
Hello,
for some files (until now, it happened only with ODS files), it seems the reader wrongly see all the 1024 columns as part of the sheet, even if just three columns are used. Basically the reader, from the fourth column on, returns an empty string for every cell.
I am not sure if it's a spout issue and most of the time it doesn't happen, I cannot reproduce the issue starting from a new ODS file but I have an ODS file that triggers the issue, if you need it.
Thanks.
The text was updated successfully, but these errors were encountered: