Documentation

Xml extends BaseReader
in package

Reader for SpreadsheetML, the XML schema for Microsoft Office Excel 2003.

Table of Contents

Constants

NAMESPACES_SS  = 'urn:schemas-microsoft-com:office:spreadsheet'

Properties

$fileHandle  : resource
$ignoreRowsWithNoCells  : bool
Ignore rows with no cells? Identifies whether the Reader should ignore rows with no cells.
$includeCharts  : bool
Read charts that are defined in the workbook? Identifies whether the Reader should read the definitions for any charts that exist in the workbook;.
$loadSheetsOnly  : null|array<string|int, string>
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.
$readDataOnly  : bool
Read data only? Identifies whether the Reader should only read data values for cells, and ignore any formatting information; or whether it should read both data and formatting.
$readEmptyCells  : bool
Read empty cells? Identifies whether the Reader should read data values for all cells, or should ignore cells containing null value or empty string.
$readFilter  : IReadFilter
IReadFilter instance.
$securityScanner  : XmlScanner|null
$styles  : array<string|int, mixed>
Formats.
$valueBinder  : IValueBinder|null
$fileContents  : string
$xmlFailMessage  : string

Methods

__construct()  : mixed
Create a new Excel2003XML Reader instance.
canRead()  : bool
Can the current IReader read the file?
getIgnoreRowsWithNoCells()  : bool
getIncludeCharts()  : bool
Read charts in workbook? If this is true, then the Reader will include any charts that exist in the workbook.
getLoadSheetsOnly()  : array<string|int, mixed>|null
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()  : bool
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).
getReadEmptyCells()  : bool
Read empty cells? If this is true (the default), then the Reader will read data values for all cells, irrespective of value.
getReadFilter()  : IReadFilter
Read filter.
getSecurityScanner()  : XmlScanner|null
getSecurityScannerOrThrow()  : XmlScanner
getValueBinder()  : IValueBinder|null
listWorksheetInfo()  : array<string|int, mixed>
Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
listWorksheetNames()  : array<string|int, mixed>
Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object.
load()  : Spreadsheet
Loads Spreadsheet from file.
loadIntoExisting()  : Spreadsheet
Loads from file or contents into Spreadsheet instance.
loadSpreadsheetFromString()  : Spreadsheet
Loads Spreadsheet from string.
setIgnoreRowsWithNoCells()  : self
setIncludeCharts()  : $this
Set read charts in workbook Set to true, to advise the Reader to include any charts that exist in the workbook.
setLoadAllSheets()  : $this
Set all sheets to load Tells the Reader to load all worksheets from the workbook.
setLoadSheetsOnly()  : $this
Set which sheets to load.
setReadDataOnly()  : $this
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()  : $this
Set read empty cells Set to true (the default) to advise the Reader read data values for all cells, irrespective of value.
setReadFilter()  : $this
Set read filter.
setValueBinder()  : self
unentity()  : string
xmlMappings()  : array<string|int, mixed>
loadSpreadsheetFromFile()  : Spreadsheet
Loads Spreadsheet from file.
openFile()  : void
Open file for reading.
parseCellComment()  : void
parseRichText()  : RichText
processFlags()  : void
getAttributes()  : SimpleXMLElement
trySimpleXMLLoadStringPrivate()  : false|SimpleXMLElement

Constants

NAMESPACES_SS

public mixed NAMESPACES_SS = 'urn:schemas-microsoft-com:office:spreadsheet'

Properties

$ignoreRowsWithNoCells

Ignore rows with no cells? Identifies whether the Reader should ignore rows with no cells.

protected bool $ignoreRowsWithNoCells = false

Currently implemented only for Xlsx.

$includeCharts

Read charts that are defined in the workbook? Identifies whether the Reader should read the definitions for any charts that exist in the workbook;.

protected bool $includeCharts = false

$loadSheetsOnly

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.

protected null|array<string|int, string> $loadSheetsOnly = null

This property is ignored for Csv, Html, and Slk.

$readDataOnly

Read data only? Identifies whether the Reader should only read data values for cells, and ignore any formatting information; or whether it should read both data and formatting.

protected bool $readDataOnly = false

$readEmptyCells

Read empty cells? Identifies whether the Reader should read data values for all cells, or should ignore cells containing null value or empty string.

protected bool $readEmptyCells = true

$styles

Formats.

protected array<string|int, mixed> $styles = []

$fileContents

private string $fileContents = ''

$xmlFailMessage

private string $xmlFailMessage = ''

Methods

__construct()

Create a new Excel2003XML Reader instance.

public __construct() : mixed

canRead()

Can the current IReader read the file?

public canRead(string $filename) : bool
Parameters
$filename : string
Return values
bool

getIgnoreRowsWithNoCells()

public getIgnoreRowsWithNoCells() : bool
Return values
bool

getIncludeCharts()

Read charts in workbook? If this is true, then the Reader will include any charts that exist in the workbook.

public getIncludeCharts() : bool

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.

Return values
bool

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.

public getLoadSheetsOnly() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getReadDataOnly()

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).

public getReadDataOnly() : bool

If false (the default) it will read data and formatting.

Return values
bool

getReadEmptyCells()

Read empty cells? If this is true (the default), then the Reader will read data values for all cells, irrespective of value.

public getReadEmptyCells() : bool

If false it will not read data for cells containing a null value or an empty string.

Return values
bool

listWorksheetInfo()

Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).

public listWorksheetInfo(string $filename) : array<string|int, mixed>
Parameters
$filename : string
Return values
array<string|int, mixed>

listWorksheetNames()

Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object.

public listWorksheetNames(string $filename) : array<string|int, mixed>
Parameters
$filename : string
Return values
array<string|int, mixed>

load()

Loads Spreadsheet from file.

public load(string $filename[, int $flags = 0 ]) : Spreadsheet
Parameters
$filename : string

The name of the file to load

$flags : int = 0

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

Return values
Spreadsheet

loadIntoExisting()

Loads from file or contents into Spreadsheet instance.

public loadIntoExisting(string $filename, Spreadsheet $spreadsheet[, bool $useContents = false ]) : Spreadsheet
Parameters
$filename : string

file name if useContents is false else file contents

$spreadsheet : Spreadsheet
$useContents : bool = false
Return values
Spreadsheet

loadSpreadsheetFromString()

Loads Spreadsheet from string.

public loadSpreadsheetFromString(string $contents) : Spreadsheet
Parameters
$contents : string
Return values
Spreadsheet

setIgnoreRowsWithNoCells()

public setIgnoreRowsWithNoCells(bool $ignoreRowsWithNoCells) : self
Parameters
$ignoreRowsWithNoCells : bool
Return values
self

setIncludeCharts()

Set read charts in workbook Set to true, to advise the Reader to include any charts that exist in the workbook.

public setIncludeCharts(bool $includeCharts) : $this

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.

Parameters
$includeCharts : bool
Return values
$this

setLoadAllSheets()

Set all sheets to load Tells the Reader to load all worksheets from the workbook.

public setLoadAllSheets() : $this
Return values
$this

setLoadSheetsOnly()

Set which sheets to load.

public setLoadSheetsOnly(string|array<string|int, mixed>|null $sheetList) : $this
Parameters
$sheetList : string|array<string|int, mixed>|null
Return values
$this

setReadDataOnly()

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).

public setReadDataOnly(bool $readCellValuesOnly) : $this

Set to false (the default) to advise the Reader to read both data and formatting for cells.

Parameters
$readCellValuesOnly : bool
Return values
$this

setReadEmptyCells()

Set read empty cells Set to true (the default) to advise the Reader read data values for all cells, irrespective of value.

public setReadEmptyCells(bool $readEmptyCells) : $this

Set to false to advise the Reader to ignore cells containing a null value or an empty string.

Parameters
$readEmptyCells : bool
Return values
$this

unentity()

public static unentity(string $contents) : string
Parameters
$contents : string
Return values
string

xmlMappings()

public static xmlMappings() : array<string|int, mixed>
Return values
array<string|int, mixed>

loadSpreadsheetFromFile()

Loads Spreadsheet from file.

protected loadSpreadsheetFromFile(string $filename) : Spreadsheet
Parameters
$filename : string
Return values
Spreadsheet

openFile()

Open file for reading.

protected openFile(string $filename) : void
Parameters
$filename : string

parseCellComment()

protected parseCellComment(SimpleXMLElement $comment, Spreadsheet $spreadsheet, string $columnID, int $rowID) : void
Parameters
$comment : SimpleXMLElement
$spreadsheet : Spreadsheet
$columnID : string
$rowID : int

parseRichText()

protected parseRichText(string $annotation) : RichText
Parameters
$annotation : string
Return values
RichText

processFlags()

protected processFlags(int $flags) : void
Parameters
$flags : int

getAttributes()

private static getAttributes(SimpleXMLElement|null $simple, string $node) : SimpleXMLElement
Parameters
$simple : SimpleXMLElement|null
$node : string
Return values
SimpleXMLElement

trySimpleXMLLoadStringPrivate()

private trySimpleXMLLoadStringPrivate(string $filename[, string $fileOrString = 'file' ]) : false|SimpleXMLElement
Parameters
$filename : string
$fileOrString : string = 'file'
Return values
false|SimpleXMLElement

        
On this page

Search results