You are here

private function PHPExcel_Writer_HTML::_generateTableHeader in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/HTML.php \PHPExcel_Writer_HTML::_generateTableHeader()

* Generate table header * *

Parameters

PHPExcel_Worksheet $pSheet The worksheet for the table we are writing: * @return string * @throws PHPExcel_Writer_Exception

2 calls to PHPExcel_Writer_HTML::_generateTableHeader()
PHPExcel_Writer_HTML::generateSheetData in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/HTML.php
* Generate sheet data * *
PHPExcel_Writer_HTML::_generateRow in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/HTML.php
* Generate row * *

File

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

Class

PHPExcel_Writer_HTML
PHPExcel_Writer_HTML

Code

private function _generateTableHeader($pSheet) {
  $sheetIndex = $pSheet
    ->getParent()
    ->getIndex($pSheet);

  // Construct HTML
  $html = '';
  $html .= $this
    ->_setMargins($pSheet);
  if (!$this->_useInlineCss) {
    $gridlines = $pSheet
      ->getShowGridlines() ? ' gridlines' : '';
    $html .= '	<table border="0" cellpadding="0" cellspacing="0" id="sheet' . $sheetIndex . '" class="sheet' . $sheetIndex . $gridlines . '">' . PHP_EOL;
  }
  else {
    $style = isset($this->_cssStyles['table']) ? $this
      ->_assembleCSS($this->_cssStyles['table']) : '';
    if ($this->_isPdf && $pSheet
      ->getShowGridlines()) {
      $html .= '	<table border="1" cellpadding="1" id="sheet' . $sheetIndex . '" cellspacing="1" style="' . $style . '">' . PHP_EOL;
    }
    else {
      $html .= '	<table border="0" cellpadding="1" id="sheet' . $sheetIndex . '" cellspacing="0" style="' . $style . '">' . PHP_EOL;
    }
  }

  // Write <col> elements
  $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet
    ->getHighestColumn()) - 1;
  $i = -1;
  while ($i++ < $highestColumnIndex) {
    if (!$this->_isPdf) {
      if (!$this->_useInlineCss) {
        $html .= '		<col class="col' . $i . '">' . PHP_EOL;
      }
      else {
        $style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) ? $this
          ->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) : '';
        $html .= '		<col style="' . $style . '">' . PHP_EOL;
      }
    }
  }

  // Return
  return $html;
}