You are here

public function PHPExcel_Writer_HTML::generateHTMLHeader 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::generateHTMLHeader()

* Generate HTML header * *

Parameters

boolean $pIncludeStyles Include styles?: * @return string * @throws PHPExcel_Writer_Exception

4 calls to PHPExcel_Writer_HTML::generateHTMLHeader()
PHPExcel_Writer_HTML::save in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/HTML.php
* Save PHPExcel to file * *
PHPExcel_Writer_PDF_DomPDF::save in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/PDF/DomPDF.php
Save PHPExcel to file
PHPExcel_Writer_PDF_mPDF::save in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/PDF/mPDF.php
Save PHPExcel to file
PHPExcel_Writer_PDF_tcPDF::save in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/PDF/tcPDF.php
Save PHPExcel to file

File

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

Class

PHPExcel_Writer_HTML
PHPExcel_Writer_HTML

Code

public function generateHTMLHeader($pIncludeStyles = false) {

  // PHPExcel object known?
  if (is_null($this->_phpExcel)) {
    throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
  }

  // Construct HTML
  $properties = $this->_phpExcel
    ->getProperties();
  $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' . PHP_EOL;
  $html .= '<!-- Generated by PHPExcel - http://www.phpexcel.net -->' . PHP_EOL;
  $html .= '<html>' . PHP_EOL;
  $html .= '  <head>' . PHP_EOL;
  $html .= '	  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . PHP_EOL;
  if ($properties
    ->getTitle() > '') {
    $html .= '	  <title>' . htmlspecialchars($properties
      ->getTitle()) . '</title>' . PHP_EOL;
  }
  if ($properties
    ->getCreator() > '') {
    $html .= '	  <meta name="author" content="' . htmlspecialchars($properties
      ->getCreator()) . '" />' . PHP_EOL;
  }
  if ($properties
    ->getTitle() > '') {
    $html .= '	  <meta name="title" content="' . htmlspecialchars($properties
      ->getTitle()) . '" />' . PHP_EOL;
  }
  if ($properties
    ->getDescription() > '') {
    $html .= '	  <meta name="description" content="' . htmlspecialchars($properties
      ->getDescription()) . '" />' . PHP_EOL;
  }
  if ($properties
    ->getSubject() > '') {
    $html .= '	  <meta name="subject" content="' . htmlspecialchars($properties
      ->getSubject()) . '" />' . PHP_EOL;
  }
  if ($properties
    ->getKeywords() > '') {
    $html .= '	  <meta name="keywords" content="' . htmlspecialchars($properties
      ->getKeywords()) . '" />' . PHP_EOL;
  }
  if ($properties
    ->getCategory() > '') {
    $html .= '	  <meta name="category" content="' . htmlspecialchars($properties
      ->getCategory()) . '" />' . PHP_EOL;
  }
  if ($properties
    ->getCompany() > '') {
    $html .= '	  <meta name="company" content="' . htmlspecialchars($properties
      ->getCompany()) . '" />' . PHP_EOL;
  }
  if ($properties
    ->getManager() > '') {
    $html .= '	  <meta name="manager" content="' . htmlspecialchars($properties
      ->getManager()) . '" />' . PHP_EOL;
  }
  if ($pIncludeStyles) {
    $html .= $this
      ->generateStyles(true);
  }
  $html .= '  </head>' . PHP_EOL;
  $html .= '' . PHP_EOL;
  $html .= '  <body>' . PHP_EOL;

  // Return
  return $html;
}