From 13eaeb39cfaed16409f7fd9d1968e08be7bfd7e5 Mon Sep 17 00:00:00 2001 From: Suraxius <33047952+Suraxius@users.noreply.github.com> Date: Fri, 1 Nov 2019 00:52:20 +0100 Subject: [PATCH] Fixes issue #948 (#1228) * Fixes issue #948 by including a setUseEmbeddedCSS(false) method. Doesn't change current behaviour if not set * Removes a empty line in src/PhpSpreadsheet/Writer/Html.php that fails a test --- src/PhpSpreadsheet/Writer/Html.php | 35 +++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/PhpSpreadsheet/Writer/Html.php b/src/PhpSpreadsheet/Writer/Html.php index d626e9c4..c075329d 100644 --- a/src/PhpSpreadsheet/Writer/Html.php +++ b/src/PhpSpreadsheet/Writer/Html.php @@ -62,6 +62,13 @@ class Html extends BaseWriter */ private $useInlineCss = false; + /** + * Use embedded CSS? + * + * @var bool + */ + private $useEmbeddedCSS = true; + /** * Array of CSS styles. * @@ -1105,7 +1112,9 @@ class Html extends BaseWriter // Construct HTML $html = ''; - $html .= $this->setMargins($pSheet); + if ($this->useEmbeddedCSS) { + $html .= $this->setMargins($pSheet); + } if (!$this->useInlineCss) { $gridlines = $pSheet->getShowGridlines() ? ' gridlines' : ''; @@ -1492,6 +1501,30 @@ class Html extends BaseWriter return $this; } + /** + * Get use embedded CSS? + * + * @return bool + */ + public function getUseEmbeddedCSS() + { + return $this->useEmbeddedCSS; + } + + /** + * Set use embedded CSS? + * + * @param bool $pValue + * + * @return HTML + */ + public function setUseEmbeddedCSS($pValue) + { + $this->useEmbeddedCSS = $pValue; + + return $this; + } + /** * Add color to formatted string as inline style. *