Some Non-Excel Readers and Big Numbers

Topics: User Forum
Jul 14, 2011 at 12:41 PM
Edited Jul 14, 2011 at 7:31 PM

Hi. When I do $cell->getValue() on a big number (ISBN) like 9788498161656 with format code 0, the Excel readers get it OK, but other readers (OOCalc, Excel2003Reader) read it as 267694072.

Is there another easy way to just get the number as shown with the other readers?

(Edited from just OOCalc.)

Aug 17, 2011 at 5:11 PM
Edited Aug 17, 2011 at 5:12 PM

Well I figured out a fairly simple solution for OOCalc.php -- from...

case 'float' :
	...
	if (floor($dataValue) == $dataValue) {
		$dataValue = (integer) $dataValue;
	}

... to...

case 'float' :
	...
	if (floor($dataValue) == $dataValue) {
		if ($dataValue == (integer) $dataValue) $dataValue = (integer) $dataValue;
		else $dataValue = (double) $dataValue;
	}
Aug 17, 2011 at 5:57 PM

The above basically fixes Excel2003XML.php too...

This was the only thing keeping my app from accepting these, so pretty happy now. Yay open source.