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