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