Menu

#1 erroneous number recognition as type date

open
nobody
None
5
2004-03-11
2004-03-11
No

Hi,

I just got the problem, some numbers in text formatted
cells are recognited as type date ( int(0x16) ) with
negative value.

In the follow function createDate in reader.php fails
because of negative date values are not supported by
PHP.

As a really bad workaround (I not really know what I do :
-/ ), I modified the following code (added 4 lines) in
function _parsesheet($spos):

case Spreadsheet_Excel_Reader_Type_RK:
case Spreadsheet_Excel_Reader_Type_RK2:
$row = ord($this->data[$spos]) |
ord($this->data[$spos+1])<<8;
$column = ord($this->data[$spos+2]) |
ord($this->data[$spos+3])<<8;
$rknum = $this->_GetInt4d($this->data, $spos + 6);
$numValue = $this->_GetIEEE754($rknum);
if ($this->isDate($spos)) {
list($string, $raw) = $this->createDate($numValue)
;
// Meikelator workaround bugfix ... (he did'nt
know, what he did .. but it fixes
// false date type recognition ...
if ($raw < 0) { // if date value not supported ...
$string = $numValue;
unset($this->rectype);
}
// end meikelator bugfix ...
}else{
$raw = $numValue;
$string = sprintf($this->curformat, $numValue *
$this->multiplier);
//$this->addcell(RKRecord($r));
}
$this->addcell($row, $column, $string, $raw);
//echo "Type_RK $row $column $string $raw
{$this->curformat}\n";
break;

---------------------

it's crappy, but works ... any better idea?

thx4all : deka

(if you need more information about: let me know ...)

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.