public function PHPExcel_Writer_HTML::generateStyles in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/HTML.php \PHPExcel_Writer_HTML::generateStyles()
* Generate CSS styles * *
Parameters
boolean $generateSurroundingHTML Generate surrounding HTML tags? (<style> and </style>): * @return string * @throws PHPExcel_Writer_Exception
1 call to PHPExcel_Writer_HTML::generateStyles()
- PHPExcel_Writer_HTML::generateHTMLHeader in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ HTML.php - * Generate HTML header * *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ HTML.php, line 679
Class
- PHPExcel_Writer_HTML
- PHPExcel_Writer_HTML
Code
public function generateStyles($generateSurroundingHTML = true) {
// PHPExcel object known?
if (is_null($this->_phpExcel)) {
throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
}
// Build CSS
$css = $this
->buildCSS($generateSurroundingHTML);
// Construct HTML
$html = '';
// Start styles
if ($generateSurroundingHTML) {
$html .= ' <style type="text/css">' . PHP_EOL;
$html .= ' html { ' . $this
->_assembleCSS($css['html']) . ' }' . PHP_EOL;
}
// Write all other styles
foreach ($css as $styleName => $styleDefinition) {
if ($styleName != 'html') {
$html .= ' ' . $styleName . ' { ' . $this
->_assembleCSS($styleDefinition) . ' }' . PHP_EOL;
}
}
// End styles
if ($generateSurroundingHTML) {
$html .= ' </style>' . PHP_EOL;
}
// Return
return $html;
}