Skip to content

Commit 92b0a84

Browse files
committed
Minor Breaking Change - Move Some BaseWriter Properties
When Conditional and Table Formatting were added to Html Reader, properties, getters, and setters were added to BaseReader. They should have been added to Html Reader instead, and this PR moves them from one to the other. It is technically a breaking change, but, since there is no reason to use them with any writer other than Html, I don't anticipate anyone seeing any adverse effects.
1 parent 747ccd1 commit 92b0a84

File tree

2 files changed

+22
-42
lines changed

2 files changed

+22
-42
lines changed

src/PhpSpreadsheet/Writer/BaseWriter.php

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace PhpOffice\PhpSpreadsheet\Writer;
44

5-
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
6-
75
abstract class BaseWriter implements IWriter
86
{
97
/**
@@ -19,18 +17,6 @@ abstract class BaseWriter implements IWriter
1917
*/
2018
protected bool $preCalculateFormulas = true;
2119

22-
/**
23-
* Table formats
24-
* Enables table formats in writer, disabled here, must be enabled in writer via a setter.
25-
*/
26-
protected bool $tableFormats = false;
27-
28-
/**
29-
* Conditional Formatting
30-
* Enables conditional formatting in writer, disabled here, must be enabled in writer via a setter.
31-
*/
32-
protected bool $conditionalFormatting = false;
33-
3420
/**
3521
* Use disk caching where possible?
3622
*/
@@ -72,34 +58,6 @@ public function setPreCalculateFormulas(bool $precalculateFormulas): self
7258
return $this;
7359
}
7460

75-
public function getTableFormats(): bool
76-
{
77-
return $this->tableFormats;
78-
}
79-
80-
public function setTableFormats(bool $tableFormats): self
81-
{
82-
if ($tableFormats) {
83-
throw new PhpSpreadsheetException('Table formatting not implemented for this writer');
84-
}
85-
86-
return $this;
87-
}
88-
89-
public function getConditionalFormatting(): bool
90-
{
91-
return $this->conditionalFormatting;
92-
}
93-
94-
public function setConditionalFormatting(bool $conditionalFormatting): self
95-
{
96-
if ($conditionalFormatting) {
97-
throw new PhpSpreadsheetException('Conditional Formatting not implemented for this writer');
98-
}
99-
100-
return $this;
101-
}
102-
10361
public function getUseDiskCaching(): bool
10462
{
10563
return $this->useDiskCaching;

src/PhpSpreadsheet/Writer/Html.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,18 @@ class Html extends BaseWriter
158158

159159
private string $getFalse = 'FALSE';
160160

161+
/**
162+
* Table formats
163+
* Enables table formats in writer, disabled here, must be enabled in writer via a setter.
164+
*/
165+
protected bool $tableFormats = false;
166+
167+
/**
168+
* Conditional Formatting
169+
* Enables conditional formatting in writer, disabled here, must be enabled in writer via a setter.
170+
*/
171+
protected bool $conditionalFormatting = false;
172+
161173
/**
162174
* Create a new HTML.
163175
*/
@@ -1849,13 +1861,23 @@ public function setUseInlineCss(bool $useInlineCss): static
18491861
return $this;
18501862
}
18511863

1864+
public function getTableFormats(): bool
1865+
{
1866+
return $this->tableFormats;
1867+
}
1868+
18521869
public function setTableFormats(bool $tableFormats): self
18531870
{
18541871
$this->tableFormats = $tableFormats;
18551872

18561873
return $this;
18571874
}
18581875

1876+
public function getConditionalFormatting(): bool
1877+
{
1878+
return $this->conditionalFormatting;
1879+
}
1880+
18591881
public function setConditionalFormatting(bool $conditionalFormatting): self
18601882
{
18611883
$this->conditionalFormatting = $conditionalFormatting;

0 commit comments

Comments
 (0)