What steps will reproduce the problem?
1. Put a formula in spreadsheet with boolean or string result
What is the expected output? What do you see instead?
Desired output is the result of the formula in the cells array. Instead, it
is as if the cell is empty.
What version of the product are you using? On what operating system?
NA
Please provide any additional information below.
I have a private version of the code in which I've made the necessary
changes to support boolean (see mmpbool) and string (see mmptext) strings.
Please note, this is based on an older version of the code when the
constants were not all uppercase. In any case, here is the code in case you
would like to incorporate it into the next release:
case Spreadsheet_Excel_Reader_Type_FORMULA:
case Spreadsheet_Excel_Reader_Type_FORMULA2:
$row = ord($this->data[$spos]) |
ord($this->data[$spos+1])<<8;
$column = ord($this->data[$spos+2]) |
ord($this->data[$spos+3])<<8;
if ((ord($this->data[$spos+6])==0) &&
(ord($this->data[$spos+12])==255) && (ord($this->data[$spos+13])==255)) {
//String formula. Result follows in a STRING record
//mmptext begin
echo "FORMULA $row $column Formula with a
string<br>\n";
$SAVErow = $row; $SAVEcolumn = $column;
// the SAVE values are used in the STRING record
//mmptext end
} elseif ((ord($this->data[$spos+6])==1) &&
(ord($this->data[$spos+12])==255) && (ord($this->data[$spos+13])==255)) {
//Boolean formula. Result is in +2; 0=false,1=true
//mmpbool begin
if (ord($this->data[$spos+8])==1) {
$this->addcell($row, $column, "TRUE", 1);
} else {
$this->addcell($row, $column, "FALSE", 0);
}
//mmpbool end
} elseif ((ord($this->data[$spos+6])==2) &&
(ord($this->data[$spos+12])==255) && (ord($this->data[$spos+13])==255)) {
//Error formula. Error code is in +2;
} elseif ((ord($this->data[$spos+6])==3) &&
(ord($this->data[$spos+12])==255) && (ord($this->data[$spos+13])==255)) {
//Formula result is a null string.
//mmptext begin
$this->addcell($row, $column, '');
//mmptext end
} else {
// result is a number, so first 14 bytes are just
like a _NUMBER record
$tmp = unpack("ddouble", substr($this->data, $spos
+ 6, 8)); // It machine machine dependent
if ($this->isDate($spos)) {
list($string, $raw) =
$this->createDate($tmp['double']);
// $this->addcell(DateRecord($r, 1));
}else{
//$raw = $tmp[''];
if (isset($this->_columnsFormat[$column + 1])){
$this->curformat =
$this->_columnsFormat[$column + 1];
}
$raw = $this->createNumber($spos);
$string = sprintf($this->curformat, $raw *
$this->multiplier);
// $this->addcell(NumberRecord($r));
}
$this->addcell($row, $column, $string, $raw);
//echo "Number $row $column $string\n";
}
break;
//mmptext begin
case Spreadsheet_Excel_Reader_Type_STRING:
echo "Found a STRING\n<br>";
if ($version == Spreadsheet_Excel_Reader_BIFF8){
// Unicode 16 string, like an SST record
echo "In STRING section, BIFF8\n<br>";
$xpos = $spos;
$numChars =
ord($this->data[$xpos]) | (ord($this->data[$xpos+1]) << 8);
$xpos += 2;
$optionFlags =
ord($this->data[$xpos]);
$xpos++;
$asciiEncoding = (($optionFlags &
0x01) == 0) ;
$extendedString = (
($optionFlags & 0x04) != 0);
// See if string contains
formatting information
$richString = (
($optionFlags & 0x08) != 0);
if ($richString) {
// Read in the crun
$formattingRuns =
ord($this->data[$xpos]) | (ord($this->data[$xpos+1]) << 8);
$xpos += 2;
}
if ($extendedString) {
// Read in cchExtRst
$extendedRunLength =
$this->_GetInt4d($this->data, $xpos);
$xpos += 4;
}
$len = ($asciiEncoding)?
$numChars : $numChars*2;
$retstr =
substr($this->data, $xpos, $len);
$xpos += $len;
$retstr = ($asciiEncoding)
? $retstr : $this->_encodeUTF16($retstr);
echo "Str = $retstr\n<br>";
//$this->sst[]=$retstr;
}elseif ($version == Spreadsheet_Excel_Reader_BIFF7){
// Simple byte string
echo "In STRING section, BIFF7\n<br>";
$xpos = $spos;
$numChars =
ord($this->data[$xpos]) | (ord($this->data[$xpos+1]) << 8);
$xpos += 2;
$retstr =
substr($this->data, $xpos, $numChars);
echo "Str = $retstr\n<br>";
}
$this->addcell($SAVErow, $SAVEcolumn, $retstr);
break;
//mmptext end
case Spreadsheet_Excel_Reader_Type_BOOLERR: