You are here

private function PHPExcel_Writer_HTML::_extendRowsForChartsAndImages in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/HTML.php \PHPExcel_Writer_HTML::_extendRowsForChartsAndImages()
1 call to PHPExcel_Writer_HTML::_extendRowsForChartsAndImages()
PHPExcel_Writer_HTML::generateSheetData in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/HTML.php
* Generate sheet data * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/HTML.php, line 511

Class

PHPExcel_Writer_HTML
PHPExcel_Writer_HTML

Code

private function _extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row) {
  $rowMax = $row;
  $colMax = 'A';
  if ($this->_includeCharts) {
    foreach ($pSheet
      ->getChartCollection() as $chart) {
      if ($chart instanceof PHPExcel_Chart) {
        $chartCoordinates = $chart
          ->getTopLeftPosition();
        $chartTL = PHPExcel_Cell::coordinateFromString($chartCoordinates['cell']);
        $chartCol = PHPExcel_Cell::columnIndexFromString($chartTL[0]);
        if ($chartTL[1] > $rowMax) {
          $rowMax = $chartTL[1];
          if ($chartCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
            $colMax = $chartTL[0];
          }
        }
      }
    }
  }
  foreach ($pSheet
    ->getDrawingCollection() as $drawing) {
    if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
      $imageTL = PHPExcel_Cell::coordinateFromString($drawing
        ->getCoordinates());
      $imageCol = PHPExcel_Cell::columnIndexFromString($imageTL[0]);
      if ($imageTL[1] > $rowMax) {
        $rowMax = $imageTL[1];
        if ($imageCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
          $colMax = $imageTL[0];
        }
      }
    }
  }
  $html = '';
  $colMax++;
  while ($row < $rowMax) {
    $html .= '<tr>';
    for ($col = 'A'; $col != $colMax; ++$col) {
      $html .= '<td>';
      $html .= $this
        ->_writeImageInCell($pSheet, $col . $row);
      if ($this->_includeCharts) {
        $html .= $this
          ->_writeChartInCell($pSheet, $col . $row);
      }
      $html .= '</td>';
    }
    ++$row;
    $html .= '</tr>';
  }
  return $html;
}