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\Reader;
4
 
5
use PhpOffice\PhpSpreadsheet\Spreadsheet;
6
 
7
interface IReader
8
{
9
    /**
10
     * Flag used to load the charts.
11
     *
12
     * This flag is supported only for some formats.
13
     */
14
    public const LOAD_WITH_CHARTS = 1;
15
 
16
    /**
17
     * Flag used to read data only, not style or structure information.
18
     */
19
    public const READ_DATA_ONLY = 2;
20
 
21
    /**
22
     * Flag used to ignore empty cells when reading.
23
     *
24
     * The ignored cells will not be instantiated.
25
     */
26
    public const IGNORE_EMPTY_CELLS = 4;
27
 
28
    /**
29
     * Flag used to ignore rows without cells.
30
     *
31
     * This flag is supported only for some formats.
32
     * This can heavily improve performance for some files.
33
     */
34
    public const IGNORE_ROWS_WITH_NO_CELLS = 8;
35
 
36
    public function __construct();
37
 
38
    /**
39
     * Can the current IReader read the file?
40
     */
41
    public function canRead(string $filename): bool;
42
 
43
    /**
44
     * Read data only?
45
     *        If this is true, then the Reader will only read data values for cells, it will not read any formatting
46
     *           or structural information (like merges).
47
     *        If false (the default) it will read data and formatting.
48
     */
49
    public function getReadDataOnly(): bool;
50
 
51
    /**
52
     * Set read data only
53
     *        Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting
54
     *            or structural information (like merges).
55
     *        Set to false (the default) to advise the Reader to read both data and formatting for cells.
56
     *
57
     * @return $this
58
     */
59
    public function setReadDataOnly(bool $readDataOnly): self;
60
 
61
    /**
62
     * Read empty cells?
63
     *        If this is true (the default), then the Reader will read data values for all cells, irrespective of value.
64
     *        If false it will not read data for cells containing a null value or an empty string.
65
     */
66
    public function getReadEmptyCells(): bool;
67
 
68
    /**
69
     * Set read empty cells
70
     *        Set to true (the default) to advise the Reader read data values for all cells, irrespective of value.
71
     *        Set to false to advise the Reader to ignore cells containing a null value or an empty string.
72
     *
73
     * @return $this
74
     */
75
    public function setReadEmptyCells(bool $readEmptyCells): self;
76
 
77
    /**
78
     * Read charts in workbook?
79
     *      If this is true, then the Reader will include any charts that exist in the workbook.
80
     *         Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
81
     *      If false (the default) it will ignore any charts defined in the workbook file.
82
     */
83
    public function getIncludeCharts(): bool;
84
 
85
    /**
86
     * Set read charts in workbook
87
     *     Set to true, to advise the Reader to include any charts that exist in the workbook.
88
     *         Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
89
     *     Set to false (the default) to discard charts.
90
     *
91
     * @return $this
92
     */
93
    public function setIncludeCharts(bool $includeCharts): self;
94
 
95
    /**
96
     * Get which sheets to load
97
     * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
98
     *        indicating that all worksheets in the workbook should be loaded.
99
     */
100
    public function getLoadSheetsOnly(): ?array;
101
 
102
    /**
103
     * Set which sheets to load.
104
     *
105
     * @param null|array|string $value This should be either an array of worksheet names to be loaded,
106
     *          or a string containing a single worksheet name. If NULL, then it tells the Reader to
107
     *          read all worksheets in the workbook
108
     *
109
     * @return $this
110
     */
111
    public function setLoadSheetsOnly(string|array|null $value): self;
112
 
113
    /**
114
     * Set all sheets to load
115
     *        Tells the Reader to load all worksheets from the workbook.
116
     *
117
     * @return $this
118
     */
119
    public function setLoadAllSheets(): self;
120
 
121
    /**
122
     * Read filter.
123
     */
124
    public function getReadFilter(): IReadFilter;
125
 
126
    /**
127
     * Set read filter.
128
     *
129
     * @return $this
130
     */
131
    public function setReadFilter(IReadFilter $readFilter): self;
132
 
133
    /**
134
     * Loads PhpSpreadsheet from file.
135
     *
136
     * @param string $filename The name of the file to load
137
     * @param int $flags Flags that can change the behaviour of the Writer:
138
     *            self::LOAD_WITH_CHARTS    Load any charts that are defined (if the Reader supports Charts)
139
     *            self::READ_DATA_ONLY      Read only data, not style or structure information, from the file
140
     *            self::IGNORE_EMPTY_CELLS  Don't read empty cells (cells that contain a null value,
141
     *                                      empty string, or a string containing only whitespace characters)
142
     */
143
    public function load(string $filename, int $flags = 0): Spreadsheet;
144
}