@@ -385,7 +385,7 @@ private function fillNextRows($rows, $line)
385
385
$ unmergedRows = array ();
386
386
foreach ($ rows [$ line ] as $ column => $ cell ) {
387
387
if ($ cell instanceof TableCell && $ cell ->getRowspan () > 1 ) {
388
- $ nbLines = $ cell ->getRowspan ()- 1 ;
388
+ $ nbLines = $ cell ->getRowspan () - 1 ;
389
389
$ lines = array ($ cell );
390
390
if (strstr ($ cell , "\n" )) {
391
391
$ lines = explode ("\n" , $ cell );
@@ -412,7 +412,7 @@ private function fillNextRows($rows, $line)
412
412
array_splice ($ rows [$ unmergedRowKey ], $ cellKey , 0 , array ($ cell ));
413
413
}
414
414
} else {
415
- $ row = $ this ->copyRow ($ rows , $ unmergedRowKey- 1 );
415
+ $ row = $ this ->copyRow ($ rows , $ unmergedRowKey - 1 );
416
416
foreach ($ unmergedRow as $ column => $ cell ) {
417
417
if (!empty ($ cell )) {
418
418
$ row [$ column ] = $ unmergedRow [$ column ];
@@ -476,7 +476,7 @@ private function getNumberOfColumns(array $row)
476
476
{
477
477
$ columns = count ($ row );
478
478
foreach ($ row as $ column ) {
479
- $ columns += $ column instanceof TableCell ? ($ column ->getColspan ()- 1 ) : 0 ;
479
+ $ columns += $ column instanceof TableCell ? ($ column ->getColspan () - 1 ) : 0 ;
480
480
}
481
481
482
482
return $ columns ;
@@ -491,11 +491,11 @@ private function getNumberOfColumns(array $row)
491
491
*/
492
492
private function getRowColumns ($ row )
493
493
{
494
- $ columns = range (0 , $ this ->numberOfColumns - 1 );
494
+ $ columns = range (0 , $ this ->numberOfColumns - 1 );
495
495
foreach ($ row as $ cellKey => $ cell ) {
496
496
if ($ cell instanceof TableCell && $ cell ->getColspan () > 1 ) {
497
497
// exclude grouped columns.
498
- $ columns = array_diff ($ columns , range ($ cellKey+ 1 , $ cellKey + $ cell ->getColspan ()- 1 ));
498
+ $ columns = array_diff ($ columns , range ($ cellKey + 1 , $ cellKey + $ cell ->getColspan () - 1 ));
499
499
}
500
500
}
501
501
@@ -550,12 +550,13 @@ private function getCellWidth(array $row, $column)
550
550
{
551
551
if (isset ($ row [$ column ])) {
552
552
$ cell = $ row [$ column ];
553
+ $ cellWidth = Helper::strlenWithoutDecoration ($ this ->output ->getFormatter (), $ cell );
553
554
if ($ cell instanceof TableCell && $ cell ->getColspan () > 1 ) {
554
555
// we assume that cell value will be across more than one column.
555
- $ cell = substr ( $ cell , 0 , strlen ( $ cell)/ $ cell ->getColspan () );
556
+ $ cellWidth = $ cellWidth / $ cell ->getColspan ();
556
557
}
557
558
558
- return Helper:: strlenWithoutDecoration ( $ this -> output -> getFormatter (), $ cell ) ;
559
+ return $ cellWidth ;
559
560
}
560
561
561
562
return 0 ;
0 commit comments