Open GoogleCodeExporter opened 9 years ago
Ok. I managed to 'isolate' the issue. raw only returns something if the cells
contain a number. so if it's text it doesn't return anything.
it would be nice to return the text if it's text and raw number if it's
numeric. Now
that I know I will make the changes in myscript to get the raw value only if
it's
numeric.
Original comment by mihai.gh...@gmail.com
on 5 May 2009 at 5:11
hi, I would like to ask if how do you temporarily solve the issue on the raw
function. Thanks
Original comment by theart20...@gmail.com
on 19 May 2009 at 12:27
I use ->val to get the values and then process the numbers to remove any
formatting:
$number=Transforma($original_cell_value);
function my_is_numeric($value) {
if(preg_match ("/^(-){0,1}([0-9]+)(,[0-9][0-9][0-9])*([.][0-9]){0,1}([0-9]*)$/"
,$value)) return 1;
else if (preg_match
("/^(-){0,1}([0-9]+)(.[0-9][0-9][0-9])*([,][0-9]){0,1}([0-9]*)$/" ,$value))
return 2;
return 3;
}
function Transforma($x) {
$tip=$this->my_is_numeric($x);
if ($tip==1) $x=str_replace(',','',$x);
else if ($tip==2) {
$x=str_replace('.','',$x);
$x=str_replace(',','.',$x);
}
else $x=str_replace('"','""',$x);
return $x;
}
Original comment by mihai.gh...@gmail.com
on 19 May 2009 at 6:15
What I did was this... saves the trouble of parsing if you don't need to.
$val = $this->raw($row, $col, $sheet); // Assume we have a number.
if (!$val) $val = $this->val($row,$col,$sheet); //if not a number, get value.
Original comment by min...@wi.rr.com
on 20 May 2009 at 8:01
hi, I used your function to remove a my formatting.but I cant get to manage to
eliminate the problem of negative values. Example in the cell the value is -300
but
because it is formatted, when I retrieve it from the reader the reader still
returns
(300). Any help? thanks you very much...
Original comment by theart20...@gmail.com
on 23 May 2009 at 12:36
I guess you could look for enclosing brackets in the formatted string to
identify a
negative number.
Original comment by mihai.gh...@gmail.com
on 23 May 2009 at 7:12
Original issue reported on code.google.com by
mihai.gh...@gmail.com
on 5 May 2009 at 4:01