| 1 |
<?php |
| 2 |
|
| 3 |
namespace PhpOffice\PhpSpreadsheet\Writer; |
| 4 |
|
| 5 |
abstract class BaseWriter implements IWriter |
| 6 |
{ |
| 7 |
/** |
| 8 |
* Write charts that are defined in the workbook? |
| 9 |
* Identifies whether the Writer should write definitions for any charts that exist in the PhpSpreadsheet object;. |
| 10 |
* |
| 11 |
* @var bool |
| 12 |
*/ |
| 13 |
protected $includeCharts = false; |
| 14 |
|
| 15 |
/** |
| 16 |
* Pre-calculate formulas |
| 17 |
* Forces PhpSpreadsheet to recalculate all formulae in a workbook when saving, so that the pre-calculated values are |
| 18 |
* immediately available to MS Excel or other office spreadsheet viewer when opening the file. |
| 19 |
* |
| 20 |
* @var bool |
| 21 |
*/ |
| 22 |
protected $preCalculateFormulas = true; |
| 23 |
|
| 24 |
/** |
| 25 |
* Use disk caching where possible? |
| 26 |
* |
| 27 |
* @var bool |
| 28 |
*/ |
| 29 |
private $useDiskCaching = false; |
| 30 |
|
| 31 |
/** |
| 32 |
* Disk caching directory. |
| 33 |
* |
| 34 |
* @var string |
| 35 |
*/ |
| 36 |
private $diskCachingDirectory = './'; |
| 37 |
|
| 38 |
public function getIncludeCharts() |
| 39 |
{ |
| 40 |
return $this->includeCharts; |
| 41 |
} |
| 42 |
|
| 43 |
public function setIncludeCharts($pValue) |
| 44 |
{ |
| 45 |
$this->includeCharts = (bool) $pValue; |
| 46 |
|
| 47 |
return $this; |
| 48 |
} |
| 49 |
|
| 50 |
public function getPreCalculateFormulas() |
| 51 |
{ |
| 52 |
return $this->preCalculateFormulas; |
| 53 |
} |
| 54 |
|
| 55 |
public function setPreCalculateFormulas($pValue) |
| 56 |
{ |
| 57 |
$this->preCalculateFormulas = (bool) $pValue; |
| 58 |
|
| 59 |
return $this; |
| 60 |
} |
| 61 |
|
| 62 |
public function getUseDiskCaching() |
| 63 |
{ |
| 64 |
return $this->useDiskCaching; |
| 65 |
} |
| 66 |
|
| 67 |
public function setUseDiskCaching($pValue, $pDirectory = null) |
| 68 |
{ |
| 69 |
$this->useDiskCaching = $pValue; |
| 70 |
|
| 71 |
if ($pDirectory !== null) { |
| 72 |
if (is_dir($pDirectory)) { |
| 73 |
$this->diskCachingDirectory = $pDirectory; |
| 74 |
} else { |
| 75 |
throw new Exception("Directory does not exist: $pDirectory"); |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
return $this; |
| 80 |
} |
| 81 |
|
| 82 |
public function getDiskCachingDirectory() |
| 83 |
{ |
| 84 |
return $this->diskCachingDirectory; |
| 85 |
} |
| 86 |
} |
| 87 |
|