Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 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
    public function getIncludeCharts(): bool;
26
 
27
    /**
28
     * Set write charts in workbook
29
     *        Set to true, to advise the Writer to include any charts that exist in the PhpSpreadsheet object.
30
     *        Set to false (the default) to ignore charts.
31
     *
32
     * @return $this
33
     */
34
    public function setIncludeCharts(bool $includeCharts): self;
35
 
36
    /**
37
     * Get Pre-Calculate Formulas flag
38
     *     If this is true (the default), then the writer will recalculate all formulae in a workbook when saving,
39
     *        so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet
40
     *        viewer when opening the file
41
     *     If false, then formulae are not calculated on save. This is faster for saving in PhpSpreadsheet, but slower
42
     *        when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself.
43
     */
44
    public function getPreCalculateFormulas(): bool;
45
 
46
    /**
47
     * Set Pre-Calculate Formulas
48
     *        Set to true (the default) to advise the Writer to calculate all formulae on save
49
     *        Set to false to prevent precalculation of formulae on save.
50
     *
51
     * @param bool $precalculateFormulas Pre-Calculate Formulas?
52
     *
53
     * @return $this
54
     */
55
    public function setPreCalculateFormulas(bool $precalculateFormulas): self;
56
 
57
    /**
58
     * Save PhpSpreadsheet to file.
59
     *
60
     * @param resource|string $filename Name of the file to save
61
     * @param int $flags Flags that can change the behaviour of the Writer:
62
     *            self::SAVE_WITH_CHARTS                Save any charts that are defined (if the Writer supports Charts)
63
     *            self::DISABLE_PRECALCULATE_FORMULAE   Don't Precalculate formulae before saving the file
64
     *
65
     * @throws Exception
66
     */
67
    public function save($filename, int $flags = 0): void;
68
 
69
    /**
70
     * Get use disk caching where possible?
71
     */
72
    public function getUseDiskCaching(): bool;
73
 
74
    /**
75
     * Set use disk caching where possible?
76
     *
77
     * @param ?string $cacheDirectory Disk caching directory
78
     *
79
     * @return $this
80
     */
81
    public function setUseDiskCaching(bool $useDiskCache, ?string $cacheDirectory = null): self;
82
 
83
    /**
84
     * Get disk caching directory.
85
     */
86
    public function getDiskCachingDirectory(): string;
87
}