PHP Excel Reader : get strikeout / strikethrough value
I am looking for way to parse the strikeout / strikethrough value of cells in an Excel sheet, using if possible a PHP script. The cells that are strikeout or not contain simple text values (no formula or anything).
I have try using http://code.google.com/p/php-excel-reader/ and a few others scripts. But I have not found any PHP script that parse this specific value (strikeout) and I have try without success to add this parsing feature to the php-excel-reader.
I have try to add the following :
function lineTrought($row,$col,$sheet=0) {
return $this->fontProperty($row,$col,$sheet,'strikethrough');
}
And also add some code to this part of the parse code (indicated by **) :
case SPREADSHEET_EXCEL_READER_TYPE_FONT:
$height = v($data,$pos+4);
$option = v($data,$pos+6);
$color = v($data,$pos+8);
$weight = v($data,$pos+10);
$under = ord($data[$pos+14]);
**$strikethrough = v($data,$pos+16);**
$font = "";
// Font name
$numchars = ord($data[$pos+18]);
if ((ord($data[$pos+19]) & 1) == 0){
$font = substr($data, $pos+20, $numchars);
} else {
$font = substr($data, $pos+20, $numchars*2);
$font = $this->_encodeUTF16($font);
}
$this->fontRecords[] = array(
'height' => $height / 20,
'italic' => !!($option & 2),
'color' => $color,
'under' => !($under==0),
'bold' => ($weight==700),
**'strikethrough'=>$strikethrough,**
'font' => $font,
开发者_如何学编程 'raw' => $this->dumpHexData($data, $pos+3, $length)
);
break;
But I can't find the right data that indicate the strikethrough value. v($data,$pos+16) is incorrect and I have try a bunch of other stuff without any success.
If not possible with a PHP library, any idea on how I could parse my XLS with a Python or Perl script and then switch the data to PHP?
It seems like Spreadsheet::ParseExcel-0.55 from CPAN Perl script might work but my main application is PHP so I would need to write result to a file and parse it back in PHP or something like this.
also check out: http://www.codeplex.com/PHPExcel
it says it could read Excel files. i was using it mostly for writing, so I don't know to what extent reading is supported.
With PHPExcel (http://phpexcel.net, official url) you can read the style value from cell. For strikethrough it is something like this.
$cell->getStyle()->getFont()->getStrikethrough().
精彩评论