Skip to content
This repository was archived by the owner on Jan 2, 2019. It is now read-only.
This repository was archived by the owner on Jan 2, 2019. It is now read-only.

Bug in Excel2003XML reader, parsing merged cells #467

@bobwitlox

Description

@bobwitlox

The Excel2003XML reader class handles merged cells incorrectly when a row contains multiple merged cells. It does not increment the column counter correctly, so the subsequent merged cells have the wrong column ID.

Bugfix:

Line 602-614:

$additionalMergedCells = 0; // bugfix
if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) {
  $columnTo = $columnID;
  if (isset($cell_ss['MergeAcross'])) {
    $additionalMergedCells = (int)$cell_ss['MergeAcross'];  // bugfix
    $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1);
  }
  $rowTo = $rowID;
  if (isset($cell_ss['MergeDown'])) {
    $rowTo = $rowTo + $cell_ss['MergeDown'];
  }
  $cellRange .= ':'.$columnTo.$rowTo;
  $objPHPExcel->getActiveSheet()->mergeCells($cellRange);
}

Line 765-769:

// bugfix
while ( $additionalMergedCells > 0 ) {
  ++$columnID;
  $additionalMergedCells--;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions