Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250620) (7d9030acd6e)
|
Public Member Functions | |
canRead (string $filename) | |
Can the current IReader read the file? | |
getCodepage () | |
getIgnoreRowsWithNoCells () | |
getIncludeCharts () | |
Read charts in workbook? | |
getLoadSheetsOnly () | |
Get which sheets to load Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null indicating that all worksheets in the workbook should be loaded. | |
getReadDataOnly () | |
Read data only? | |
getReadEmptyCells () | |
Read empty cells? | |
getReadFilter () | |
Read filter. | |
getSecurityScanner () | |
getSecurityScannerOrThrow () | |
getValueBinder () | |
listWorksheetInfo (string $filename) | |
Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). | |
listWorksheetNames (string $filename) | |
Returns names of the worksheets from a file, possibly without parsing the whole file to a Spreadsheet object. | |
load (string $filename, int $flags=0) | |
Loads Spreadsheet from file. | |
setCodepage (string $codepage) | |
setIgnoreRowsWithNoCells (bool $ignoreRowsWithNoCells) | |
setIncludeCharts (bool $includeCharts) | |
Set read charts in workbook Set to true, to advise the Reader to include any charts that exist in the workbook. | |
setLoadAllSheets () | |
Set all sheets to load Tells the Reader to load all worksheets from the workbook. | |
setLoadSheetsOnly (string|array|null $sheetList) | |
Set which sheets to load. | |
setReadDataOnly (bool $readCellValuesOnly) | |
Set read data only Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting or structural information (like merges). | |
setReadEmptyCells (bool $readEmptyCells) | |
Set read empty cells Set to true (the default) to advise the Reader read data values for all cells, irrespective of value. | |
setReadFilter (IReadFilter $readFilter) | |
Set read filter. | |
setValueBinder (?IValueBinder $valueBinder) | |
Public Attributes | |
final const | BORDER_STYLE_MAP |
const | IGNORE_EMPTY_CELLS = 4 |
Flag used to ignore empty cells when reading. | |
const | IGNORE_ROWS_WITH_NO_CELLS = 8 |
Flag used to ignore rows without cells. | |
const | LOAD_WITH_CHARTS = 1 |
final const | MS_BIFF_CRYPTO_NONE = 0 |
final const | MS_BIFF_CRYPTO_RC4 = 2 |
final const | MS_BIFF_CRYPTO_XOR = 1 |
const | READ_DATA_ONLY = 2 |
Flag used to read data only, not style or structure information. | |
final const | REKEY_BLOCK = 0x400 |
final const | XLS_BIFF7 = 0x0500 |
final const | XLS_BIFF8 = 0x0600 |
final const | XLS_TYPE_ARRAY = 0x0221 |
final const | XLS_TYPE_BLANK = 0x0201 |
final const | XLS_TYPE_BOF = 0x0809 |
final const | XLS_TYPE_BOOLERR = 0x0205 |
final const | XLS_TYPE_BOTTOMMARGIN = 0x0029 |
final const | XLS_TYPE_CFHEADER = 0x01B0 |
final const | XLS_TYPE_CFRULE = 0x01B1 |
final const | XLS_TYPE_CODEPAGE = 0x0042 |
final const | XLS_TYPE_COLINFO = 0x007D |
final const | XLS_TYPE_CONTINUE = 0x003C |
final const | XLS_TYPE_DATAVALIDATION = 0x01BE |
final const | XLS_TYPE_DATAVALIDATIONS = 0x01B2 |
final const | XLS_TYPE_DATEMODE = 0x0022 |
final const | XLS_TYPE_DBCELL = 0x00D7 |
final const | XLS_TYPE_DEFAULTROWHEIGHT = 0x0225 |
final const | XLS_TYPE_DEFCOLWIDTH = 0x0055 |
final const | XLS_TYPE_DEFINEDNAME = 0x0018 |
final const | XLS_TYPE_DIMENSION = 0x0200 |
final const | XLS_TYPE_EOF = 0x000A |
final const | XLS_TYPE_EXTERNALBOOK = 0x01AE |
final const | XLS_TYPE_EXTERNNAME = 0x0023 |
final const | XLS_TYPE_EXTERNSHEET = 0x0017 |
final const | XLS_TYPE_EXTSST = 0x00FF |
final const | XLS_TYPE_FILEPASS = 0x002F |
final const | XLS_TYPE_FONT = 0x0031 |
final const | XLS_TYPE_FOOTER = 0x0015 |
final const | XLS_TYPE_FORMAT = 0x041E |
final const | XLS_TYPE_FORMULA = 0x0006 |
final const | XLS_TYPE_HCENTER = 0x0083 |
final const | XLS_TYPE_HEADER = 0x0014 |
final const | XLS_TYPE_HORIZONTALPAGEBREAKS = 0x001B |
final const | XLS_TYPE_HYPERLINK = 0x01B8 |
final const | XLS_TYPE_IMDATA = 0x007F |
final const | XLS_TYPE_INDEX = 0x020B |
final const | XLS_TYPE_LABEL = 0x0204 |
final const | XLS_TYPE_LABELSST = 0x00FD |
final const | XLS_TYPE_LEFTMARGIN = 0x0026 |
final const | XLS_TYPE_MERGEDCELLS = 0x00E5 |
final const | XLS_TYPE_MSODRAWING = 0x00EC |
final const | XLS_TYPE_MSODRAWINGGROUP = 0x00EB |
final const | XLS_TYPE_MULBLANK = 0x00BE |
final const | XLS_TYPE_MULRK = 0x00BD |
final const | XLS_TYPE_NOTE = 0x001C |
final const | XLS_TYPE_NUMBER = 0x0203 |
final const | XLS_TYPE_OBJ = 0x005D |
final const | XLS_TYPE_OBJECTPROTECT = 0x0063 |
final const | XLS_TYPE_PAGELAYOUTVIEW = 0x088B |
final const | XLS_TYPE_PAGESETUP = 0x00A1 |
final const | XLS_TYPE_PALETTE = 0x0092 |
final const | XLS_TYPE_PANE = 0x0041 |
final const | XLS_TYPE_PASSWORD = 0x0013 |
final const | XLS_TYPE_PRINTGRIDLINES = 0x002B |
final const | XLS_TYPE_PROTECT = 0x0012 |
final const | XLS_TYPE_RANGEPROTECTION = 0x0868 |
final const | XLS_TYPE_RIGHTMARGIN = 0x0027 |
final const | XLS_TYPE_RK = 0x027E |
final const | XLS_TYPE_ROW = 0x0208 |
final const | XLS_TYPE_SCENPROTECT = 0x00DD |
final const | XLS_TYPE_SCL = 0x00A0 |
final const | XLS_TYPE_SELECTION = 0x001D |
final const | XLS_TYPE_SHAREDFMLA = 0x04BC |
final const | XLS_TYPE_SHEET = 0x0085 |
final const | XLS_TYPE_SHEETLAYOUT = 0x0862 |
final const | XLS_TYPE_SHEETPR = 0x0081 |
final const | XLS_TYPE_SHEETPROTECTION = 0x0867 |
final const | XLS_TYPE_SST = 0x00FC |
final const | XLS_TYPE_STRING = 0x0207 |
final const | XLS_TYPE_STYLE = 0x0293 |
final const | XLS_TYPE_TOPMARGIN = 0x0028 |
final const | XLS_TYPE_TXO = 0x01B6 |
final const | XLS_TYPE_UNKNOWN = 0xFFFF |
final const | XLS_TYPE_VCENTER = 0x0084 |
final const | XLS_TYPE_VERTICALPAGEBREAKS = 0x001A |
final const | XLS_TYPE_WINDOW2 = 0x023E |
final const | XLS_TYPE_XF = 0x00E0 |
final const | XLS_TYPE_XFEXT = 0x087D |
final const | XLS_WORKBOOKGLOBALS = 0x0005 |
final const | XLS_WORKSHEET = 0x0010 |
Protected Member Functions | |
decodeCodepage (string $string) | |
Convert string to UTF-8. | |
loadSpreadsheetFromFile (string $filename) | |
openFile (string $filename) | |
Open file for reading. | |
processFlags (int $flags) | |
Static Protected Member Functions | |
static | encodeUTF16 (string $string, bool $compressed=false) |
Get UTF-8 string from (compressed or uncompressed) UTF-16 string. | |
static | extractNumber (string $data) |
Reads first 8 bytes of a string and return IEEE 754 float. | |
static | getIEEE754 (int $rknum) |
static | readRGB (string $rgb) |
Extract RGB color OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.4. | |
static | readUnicodeString (string $subData, int $characterCount) |
Read Unicode string with no string length field, but with known character count this function is under construction, needs to support rich text, and Asian phonetic settings OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.3. | |
static | readUnicodeStringLong (string $subData) |
Extracts an Excel Unicode long string (16-bit string length) OpenOffice documentation: 2.5.3 this function is under construction, needs to support rich text, and Asian phonetic settings. | |
static | readUnicodeStringShort (string $subData) |
Extracts an Excel Unicode short string (8-bit string length) OpenOffice documentation: 2.5.3 function will automatically find out where the Unicode string ends. | |
static | uncompressByteString (string $string) |
Convert UTF-16 string in compressed notation to uncompressed form. | |
static | UTF8toExcelDoubleQuoted (string $value) |
Convert UTF-8 string to string surounded by double quotes. | |
Protected Attributes | |
string | $codepage = '' |
resource | $fileHandle |
bool | $ignoreRowsWithNoCells = false |
Ignore rows with no cells? | |
bool | $includeCharts = false |
Read charts that are defined in the workbook? | |
null string[] array | $loadSheetsOnly = null |
Restrict which sheets should be loaded? | |
bool | $readDataOnly = false |
bool | $readEmptyCells = true |
Read empty cells? | |
IReadFilter | $readFilter |
IReadFilter instance. | |
XmlScanner | $securityScanner = null |
IValueBinder | $valueBinder = null |
final const | FC000000 = 0xFC << 24 |
final const | FE000000 = 0xFE << 24 |
final const | HIGH_ORDER_BIT = 0x80 << 24 |
PhpOffice\PhpSpreadsheet\Reader\XlsBase::canRead | ( | string | $filename | ) |
Can the current IReader read the file?
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
protected |
Convert string to UTF-8.
Only used for BIFF5.
|
staticprotected |
Reads first 8 bytes of a string and return IEEE 754 float.
string | $data | Binary string that is at least 8 bytes long |
|
inherited |
Read charts in workbook?
If this is true, then the Reader will include any charts that exist in the workbook. Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value. If false (the default) it will ignore any charts defined in the workbook file.
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
inherited |
Get which sheets to load Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null indicating that all worksheets in the workbook should be loaded.
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
inherited |
Read data only?
If this is true, then the Reader will only read data values for cells, it will not read any formatting or structural information (like merges). If false (the default) it will read data and formatting.
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
inherited |
Read empty cells?
If this is true (the default), then the Reader will read data values for all cells, irrespective of value. If false it will not read data for cells containing a null value or an empty string.
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
inherited |
Read filter.
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
inherited |
Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
Reimplemented in PhpOffice\PhpSpreadsheet\Reader\Csv, PhpOffice\PhpSpreadsheet\Reader\Gnumeric, PhpOffice\PhpSpreadsheet\Reader\Html, PhpOffice\PhpSpreadsheet\Reader\Ods, PhpOffice\PhpSpreadsheet\Reader\Slk, PhpOffice\PhpSpreadsheet\Reader\Xlsx, and PhpOffice\PhpSpreadsheet\Reader\Xml.
|
inherited |
Returns names of the worksheets from a file, possibly without parsing the whole file to a Spreadsheet object.
Readers will often have a more efficient method with which they can override this method.
Reimplemented in PhpOffice\PhpSpreadsheet\Reader\Gnumeric, PhpOffice\PhpSpreadsheet\Reader\Ods, PhpOffice\PhpSpreadsheet\Reader\Xlsx, and PhpOffice\PhpSpreadsheet\Reader\Xml.
|
inherited |
Loads Spreadsheet from file.
int | $flags | the optional second parameter flags may be used to identify specific elements that should be loaded, but which won't be loaded by default, using these values: IReader::LOAD_WITH_CHARTS - Include any charts that are defined in the loaded file |
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
protectedinherited |
|
staticprotected |
Extract RGB color OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.4.
string | $rgb | Encoded RGB value (4 bytes) |
|
inherited |
Set read charts in workbook Set to true, to advise the Reader to include any charts that exist in the workbook.
Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value. Set to false (the default) to discard charts.
$this |
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
inherited |
Set all sheets to load Tells the Reader to load all worksheets from the workbook.
$this |
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
inherited |
Set which sheets to load.
null | array | string | $value | This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name. If NULL, then it tells the Reader to read all worksheets in the workbook |
$this |
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
inherited |
Set read data only Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting or structural information (like merges).
Set to false (the default) to advise the Reader to read both data and formatting for cells.
$this |
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
inherited |
Set read empty cells Set to true (the default) to advise the Reader read data values for all cells, irrespective of value.
Set to false to advise the Reader to ignore cells containing a null value or an empty string.
$this |
Implements PhpOffice\PhpSpreadsheet\Reader\IReader.
|
inherited |
|
staticprotected |
Convert UTF-16 string in compressed notation to uncompressed form.
Only used for BIFF8.
|
staticprotected |
Convert UTF-8 string to string surounded by double quotes.
Used for explicit string tokens in formulas. Example: hello"world --> "hello""world".
string | $value | UTF-8 encoded string |
|
protectedinherited |
Ignore rows with no cells?
Identifies whether the Reader should ignore rows with no cells. Currently implemented only for Xlsx.
|
protectedinherited |
Read charts that are defined in the workbook?
Identifies whether the Reader should read the definitions for any charts that exist in the workbook;.
|
protectedinherited |
Restrict which sheets should be loaded?
This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded. This property is ignored for Csv, Html, and Slk.
|
protectedinherited |
Read empty cells?
Identifies whether the Reader should read data values for all cells, or should ignore cells containing null value or empty string.
final const PhpOffice\PhpSpreadsheet\Reader\XlsBase::BORDER_STYLE_MAP |
|
inherited |
Flag used to ignore empty cells when reading.
The ignored cells will not be instantiated.
|
inherited |
Flag used to ignore rows without cells.
This flag is supported only for some formats. This can heavily improve performance for some files.