douyun1546 2017-09-05 09:11
浏览 108
已采纳

如何通过PHPExcel获取MergeArea?

With Excel Com: i can get MergeArea by :

oCell->MergeArea;

I want convert Excel Com to PHPExcel, But Does PhpExcel support get MergeArea? Or can get number rows, columns merged?

  • 写回答

1条回答 默认 最新

  • dongyue934001 2017-09-05 12:30
    关注

    PHPExcel maintains a list of all merge ranges on the worksheet object, and you can retrieve that list using

    $objPHPExcel->getActiveSheet()->getMergeCells();
    

    which will return a simple array containing all the defined merge ranges in that worksheet.

    If you want to tell if a particular cell is part of a merge range, then you can use

    $cell->isInMergeRange();
    

    Which will return a simple boolean true/false

    $cell->isMergeRangeValueCell();
    

    Will return a boolean true/false if this is the topleft cell in a merge range

    $cell->getMergeRange();
    

    Will return a string showing the merge range that a cell is a part of, or a boolean false if it isn't part of a merge range

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?