1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace PhpOffice\PhpSpreadsheet\Writer;
|
|
|
4 |
|
|
|
5 |
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
|
6 |
|
|
|
7 |
interface IWriter
|
|
|
8 |
{
|
|
|
9 |
public const SAVE_WITH_CHARTS = 1;
|
|
|
10 |
|
|
|
11 |
public const DISABLE_PRECALCULATE_FORMULAE = 2;
|
|
|
12 |
|
|
|
13 |
/**
|
|
|
14 |
* IWriter constructor.
|
|
|
15 |
*
|
|
|
16 |
* @param Spreadsheet $spreadsheet The spreadsheet that we want to save using this Writer
|
|
|
17 |
*/
|
|
|
18 |
public function __construct(Spreadsheet $spreadsheet);
|
|
|
19 |
|
|
|
20 |
/**
|
|
|
21 |
* Write charts in workbook?
|
|
|
22 |
* If this is true, then the Writer will write definitions for any charts that exist in the PhpSpreadsheet object.
|
|
|
23 |
* If false (the default) it will ignore any charts defined in the PhpSpreadsheet object.
|
|
|
24 |
*
|
|
|
25 |
* @return bool
|
|
|
26 |
*/
|
|
|
27 |
public function getIncludeCharts();
|
|
|
28 |
|
|
|
29 |
/**
|
|
|
30 |
* Set write charts in workbook
|
|
|
31 |
* Set to true, to advise the Writer to include any charts that exist in the PhpSpreadsheet object.
|
|
|
32 |
* Set to false (the default) to ignore charts.
|
|
|
33 |
*
|
|
|
34 |
* @param bool $includeCharts
|
|
|
35 |
*
|
|
|
36 |
* @return IWriter
|
|
|
37 |
*/
|
|
|
38 |
public function setIncludeCharts($includeCharts);
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
* Get Pre-Calculate Formulas flag
|
|
|
42 |
* If this is true (the default), then the writer will recalculate all formulae in a workbook when saving,
|
|
|
43 |
* so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet
|
|
|
44 |
* viewer when opening the file
|
|
|
45 |
* If false, then formulae are not calculated on save. This is faster for saving in PhpSpreadsheet, but slower
|
|
|
46 |
* when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself.
|
|
|
47 |
*
|
|
|
48 |
* @return bool
|
|
|
49 |
*/
|
|
|
50 |
public function getPreCalculateFormulas();
|
|
|
51 |
|
|
|
52 |
/**
|
|
|
53 |
* Set Pre-Calculate Formulas
|
|
|
54 |
* Set to true (the default) to advise the Writer to calculate all formulae on save
|
|
|
55 |
* Set to false to prevent precalculation of formulae on save.
|
|
|
56 |
*
|
|
|
57 |
* @param bool $precalculateFormulas Pre-Calculate Formulas?
|
|
|
58 |
*
|
|
|
59 |
* @return IWriter
|
|
|
60 |
*/
|
|
|
61 |
public function setPreCalculateFormulas($precalculateFormulas);
|
|
|
62 |
|
|
|
63 |
/**
|
|
|
64 |
* Save PhpSpreadsheet to file.
|
|
|
65 |
*
|
|
|
66 |
* @param resource|string $filename Name of the file to save
|
|
|
67 |
* @param int $flags Flags that can change the behaviour of the Writer:
|
|
|
68 |
* self::SAVE_WITH_CHARTS Save any charts that are defined (if the Writer supports Charts)
|
|
|
69 |
* self::DISABLE_PRECALCULATE_FORMULAE Don't Precalculate formulae before saving the file
|
|
|
70 |
*
|
|
|
71 |
* @throws Exception
|
|
|
72 |
*/
|
|
|
73 |
public function save($filename, int $flags = 0): void;
|
|
|
74 |
|
|
|
75 |
/**
|
|
|
76 |
* Get use disk caching where possible?
|
|
|
77 |
*
|
|
|
78 |
* @return bool
|
|
|
79 |
*/
|
|
|
80 |
public function getUseDiskCaching();
|
|
|
81 |
|
|
|
82 |
/**
|
|
|
83 |
* Set use disk caching where possible?
|
|
|
84 |
*
|
|
|
85 |
* @param bool $useDiskCache
|
|
|
86 |
* @param string $cacheDirectory Disk caching directory
|
|
|
87 |
*
|
|
|
88 |
* @return IWriter
|
|
|
89 |
*/
|
|
|
90 |
public function setUseDiskCaching($useDiskCache, $cacheDirectory = null);
|
|
|
91 |
|
|
|
92 |
/**
|
|
|
93 |
* Get disk caching directory.
|
|
|
94 |
*
|
|
|
95 |
* @return string
|
|
|
96 |
*/
|
|
|
97 |
public function getDiskCachingDirectory();
|
|
|
98 |
}
|