PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / libraries / vendor / PhpSpreadsheet / Reader / IReader.php

IReader.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Reader/IReader.php

176 lines 5.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TablePress\PhpOffice\PhpSpreadsheet\Reader;
4
5 use TablePress\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 /**
37 * Allow external images. Use with caution.
38 * Improper specification of these within a spreadsheet
39 * can subject the caller to security exploits.
40 */
41 public const ALLOW_EXTERNAL_IMAGES = 16;
42 public const DONT_ALLOW_EXTERNAL_IMAGES = 32;
43
44 public const CREATE_BLANK_SHEET_IF_NONE_READ = 64;
45
46 public function __construct();
47
48 /**
49 * Can the current IReader read the file?
50 */
51 public function canRead(string $filename): bool;
52
53 /**
54 * Read data only?
55 * If this is true, then the Reader will only read data values for cells, it will not read any formatting
56 * or structural information (like merges).
57 * If false (the default) it will read data and formatting.
58 */
59 public function getReadDataOnly(): bool;
60
61 /**
62 * Set read data only
63 * Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting
64 * or structural information (like merges).
65 * Set to false (the default) to advise the Reader to read both data and formatting for cells.
66 *
67 * @return $this
68 */
69 public function setReadDataOnly(bool $readDataOnly);
70
71 /**
72 * Read empty cells?
73 * If this is true (the default), then the Reader will read data values for all cells, irrespective of value.
74 * If false it will not read data for cells containing a null value or an empty string.
75 */
76 public function getReadEmptyCells(): bool;
77
78 /**
79 * Set read empty cells
80 * Set to true (the default) to advise the Reader read data values for all cells, irrespective of value.
81 * Set to false to advise the Reader to ignore cells containing a null value or an empty string.
82 *
83 * @return $this
84 */
85 public function setReadEmptyCells(bool $readEmptyCells);
86
87 /**
88 * Read charts in workbook?
89 * If this is true, then the Reader will include any charts that exist in the workbook.
90 * Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
91 * If false (the default) it will ignore any charts defined in the workbook file.
92 */
93 public function getIncludeCharts(): bool;
94
95 /**
96 * Set read charts in workbook
97 * Set to true, to advise the Reader to include any charts that exist in the workbook.
98 * Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
99 * Set to false (the default) to discard charts.
100 *
101 * @return $this
102 */
103 public function setIncludeCharts(bool $includeCharts);
104
105 /**
106 * Get which sheets to load
107 * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
108 * indicating that all worksheets in the workbook should be loaded.
109 *
110 * @return null|string[]
111 */
112 public function getLoadSheetsOnly(): ?array;
113
114 /**
115 * Set which sheets to load.
116 *
117 * @param null|string|string[] $value This should be either an array of worksheet names to be loaded,
118 * or a string containing a single worksheet name. If NULL, then it tells the Reader to
119 * read all worksheets in the workbook
120 *
121 * @return $this
122 */
123 public function setLoadSheetsOnly($value);
124
125 /**
126 * Set all sheets to load
127 * Tells the Reader to load all worksheets from the workbook.
128 *
129 * @return $this
130 */
131 public function setLoadAllSheets();
132
133 /**
134 * Read filter.
135 */
136 public function getReadFilter(): IReadFilter;
137
138 /**
139 * Set read filter.
140 *
141 * @return $this
142 */
143 public function setReadFilter(IReadFilter $readFilter);
144
145 /**
146 * Allow external images. Use with caution.
147 * Improper specification of these within a spreadsheet
148 * can subject the caller to security exploits.
149 */
150 public function setAllowExternalImages(bool $allowExternalImages);
151
152 public function getAllowExternalImages(): bool;
153
154 /**
155 * Create a blank sheet if none are read,
156 * possibly due to a typo when using LoadSheetsOnly.
157 */
158 public function setCreateBlankSheetIfNoneRead(bool $createBlankSheetIfNoneRead);
159
160 /**
161 * Loads PhpSpreadsheet from file.
162 *
163 * @param string $filename The name of the file to load
164 * @param int $flags Flags that can change the behaviour of the Writer:
165 * self::LOAD_WITH_CHARTS Load any charts that are defined (if the Reader supports Charts)
166 * self::READ_DATA_ONLY Read only data, not style or structure information, from the file
167 * self::IGNORE_EMPTY_CELLS Don't read empty cells (cells that contain a null value,
168 * empty string, or a string containing only whitespace characters)
169 * self::IGNORE_ROWS_WITH_NO_CELLS Don't load any rows that contain no cells.
170 * self::ALLOW_EXTERNAL_IMAGES Attempt to fetch images stored outside the spreadsheet.
171 * self::DONT_ALLOW_EXTERNAL_IMAGES Don't attempt to fetch images stored outside the spreadsheet.
172 * self::CREATE_BLANK_SHEET_IF_NONE_READ If no sheets are read, create a blank one.
173 */
174 public function load(string $filename, int $flags = 0): Spreadsheet;
175 }
176