Add consistency using getCellXML() (#306)

This commit is contained in:
Adrien Loison 2016-09-06 19:47:18 -07:00 committed by GitHub
parent 435a9a016e
commit d4e57b1f0d
2 changed files with 4 additions and 4 deletions

View File

@ -155,7 +155,7 @@ class Worksheet implements WorksheetInterface
$currentCellValue !== $dataRowWithNumericIndexes[$nextCellIndex]) { $currentCellValue !== $dataRowWithNumericIndexes[$nextCellIndex]) {
$numTimesValueRepeated = ($nextCellIndex - $currentCellIndex); $numTimesValueRepeated = ($nextCellIndex - $currentCellIndex);
$data .= $this->getCellContent($currentCellValue, $styleIndex, $numTimesValueRepeated); $data .= $this->getCellXML($currentCellValue, $styleIndex, $numTimesValueRepeated);
$currentCellIndex = $nextCellIndex; $currentCellIndex = $nextCellIndex;
} }
@ -183,7 +183,7 @@ class Worksheet implements WorksheetInterface
* @return string The cell XML content * @return string The cell XML content
* @throws \Box\Spout\Common\Exception\InvalidArgumentException If a cell value's type is not supported * @throws \Box\Spout\Common\Exception\InvalidArgumentException If a cell value's type is not supported
*/ */
protected function getCellContent($cellValue, $styleIndex, $numTimesValueRepeated) protected function getCellXML($cellValue, $styleIndex, $numTimesValueRepeated)
{ {
$data = '<table:table-cell table:style-name="ce' . $styleIndex . '"'; $data = '<table:table-cell table:style-name="ce' . $styleIndex . '"';

View File

@ -134,7 +134,7 @@ EOD;
$rowXML = '<row r="' . $rowIndex . '" spans="1:' . $numCells . '">'; $rowXML = '<row r="' . $rowIndex . '" spans="1:' . $numCells . '">';
foreach($dataRow as $cellValue) { foreach($dataRow as $cellValue) {
$rowXML .= $this->getCellXml($rowIndex, $cellNumber, $cellValue, $style->getId()); $rowXML .= $this->getCellXML($rowIndex, $cellNumber, $cellValue, $style->getId());
$cellNumber++; $cellNumber++;
} }
@ -159,7 +159,7 @@ EOD;
* @return string * @return string
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */
private function getCellXml($rowIndex, $cellNumber, $cellValue, $styleId) private function getCellXML($rowIndex, $cellNumber, $cellValue, $styleId)
{ {
$columnIndex = CellHelper::getCellIndexFromColumnIndex($cellNumber); $columnIndex = CellHelper::getCellIndexFromColumnIndex($cellNumber);
$cellXML = '<c r="' . $columnIndex . $rowIndex . '"'; $cellXML = '<c r="' . $columnIndex . $rowIndex . '"';