|
 Patrick - 2010-08-26 15:16:45
Hi,
i use your class to handle some xlsx-files with a filesize round about 14MB.
Erverything works fine until i reached row 153 inside the file.
Till row 153 $xlsx_data=$xlsx->rows($sheet); returns the complete array with round about 70-80 elements. After row 153 the array contains only 25 elements.
The script runs on shell, so there is no memory error or something else.
Did you have any idea, or reason for this?
Regards Patrick
 Sergey Shuchkin - 2010-09-20 02:08:30 - In reply to message 1 from Patrick
patrick, plz give me your .xlst book to review, may be large file've other XML structure, I'll check it
sergey.shuchkin[ бульдог ]gmail.com
 Gonzo - 2010-11-12 15:55:55 - In reply to message 2 from Sergey Shuchkin
Hi,
Empty field are not necessarily present in the XML structure of an XLSX file.
If my sheet is like this :
| A | B | C |
---------------------
1 | v1 | v2 | |
2 | | v3 | |
3 | | | v4 |
The xml data of xlsx file is like this :
<sheetData>
<row r="1" spans="1:3">
<c r="A1" t="s"><v>0</v></c>
<c r="B1" t="s"><v>1</v></c>
</row>
<row r="2" spans="1:3">
<c r="B2" t="s"><v>2</v></c>
</row>
<row r="3" spans="1:3">
<c r="C3" t="s"><v>3</v></c>
</row>
</sheetData>
And the SimpleXLSX class return an array like this :
Array (
[0] => Array (
[0] => v1
[1] => v2
)
[1] => Array (
[0] => v3
)
[2] => Array (
[0] => v4
)
)
But is not correct.
The correct result is like this :
Array (
[0] => Array (
[0] => v1
[1] => v2
)
[1] => Array (
[1] => v3
)
[2] => Array (
[2] => v4
)
)
My patch :
In the function named "rows"
- remove line 55 ($curC = 0;)
- remove line 58 ($curC++;)
- add after line 56 (foreach ($row->c as $c) {)
|=> $curC = $this->_columnIndex((string) $c['r']);
Idem in the function "rowsEx"
Add the function "_columnIndex"
|=> function _columnIndex( $index = 'A1' ) {
if (preg_match("/([$]?[A-Z]+)([$]?\d+)/", $index, $matches)) {
$index = strtoupper($matches[1]);
$strLen = strlen($index);
$result = 0;
for ($i=0; $i<$strLen; $i++) {
$result += (ord($index{$strLen-$i-1}) - 64) * pow(26, $i);
}
return $result - 1;
} else {
throw new Exception("Invalid cell index.");
}
}
Thanks
 Tom Paul Grissom - 2010-12-03 20:54:19 - In reply to message 3 from Gonzo
Same issue, Patch resolved it.
thank you,
 Sergey Shuchkin - 2010-12-21 12:05:36 - In reply to message 1 from Patrick
fixed in repository
|