代码之家  ›  专栏  ›  技术社区  ›  j15e

PHP Excel阅读器:获取删除线/删除线值

  •  1
  • j15e  · 技术社区  · 16 年前

    我正在寻找一种方法来解析Excel表中单元格的删除线/删除线值,如果可能的话,使用PHP脚本。删除线或不包含简单文本值(没有公式或任何内容)的单元格。

    http://code.google.com/p/php-excel-reader/

    我尝试添加以下内容:

    function lineTrought($row,$col,$sheet=0) {
        return $this->fontProperty($row,$col,$sheet,'strikethrough');
    }
    

                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;
    

    2 回复  |  直到 16 年前
        1
  •  1
  •   dusoft    16 年前

    http://www.codeplex.com/PHPExcel

    它说它可以读取Excel文件。我主要用它来写作,所以我不知道在多大程度上支持阅读。

        2
  •  0
  •   Signix    11 年前

    http://phpexcel.net ,官方网址),您可以从单元格中读取样式值。对于删除线来说,它是这样的。

    $cell->getStyle()->getFont()->getStrikethrough().
    
    推荐文章