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

Bug in Excel2003XML reader, parsing merged cells #467

Closed
bobwitlox opened this issue Nov 24, 2014 · 1 comment
Closed

Bug in Excel2003XML reader, parsing merged cells #467

bobwitlox opened this issue Nov 24, 2014 · 1 comment

Comments

@bobwitlox
Copy link

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--;
}
MarkBaker pushed a commit that referenced this issue Nov 26, 2014
@MarkBaker
Copy link
Member

Thanks for the fix

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants