Documentation

Gnumeric extends BaseReader

Table of Contents

NAMESPACE_GNM 'http://www.gnumeric.org/v10.dtd'
NAMESPACE_XSI 'http://www.w3.org/2001/XMLSchema-instance'
NAMESPACE_OFFICE 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'
NAMESPACE_XLINK 'http://www.w3.org/1999/xlink'
NAMESPACE_DC 'http://purl.org/dc/elements/1.1/'
NAMESPACE_META 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'
NAMESPACE_OOO 'http://openoffice.org/2004/office'
$expressions Shared Expressions. array
$spreadsheet Spreadsheet shared across all functions. Spreadsheet
$referenceHelper ReferenceHelper
$mappings array
$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. bool
$readEmptyCells Read empty cells? Identifies whether the Reader should read data values for cells all cells, or should ignore cells containing null value or empty string. bool
$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;. bool
$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. null|string[]
$readFilter IReadFilter instance. IReadFilter
$fileHandle
$securityScanner XmlScanner
__construct() Create a new Gnumeric. mixed
canRead() Can the current IReader read the file? bool
matchXml() bool
listWorksheetNames() Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object. array
listWorksheetInfo() Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). array
gzfileGetContents() string
gnumericMappings() array
processComments() void
testSimpleXml() SimpleXMLElement
load() Loads Spreadsheet from file. Spreadsheet
loadIntoExisting() Loads from file into Spreadsheet instance. Spreadsheet
processMergedCells() void
processAutofilter() void
setColumnWidth() void
setColumnInvisible() void
processColumnLoop() int
processColumnWidths() void
setRowHeight() void
setRowInvisible() void
processRowLoop() int
processRowHeights() void
processDefinedNames() void
parseRichText() RichText
__construct() IReader constructor. mixed
getReadDataOnly() Read data only? If this is true, then the Reader will only read data values for cells, it will not read any formatting information. bool
setReadDataOnly() Set read data only Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information. IReader
getReadEmptyCells() Read empty cells? If this is true (the default), then the Reader will read data values for all cells, irrespective of value. bool
setReadEmptyCells() Set read empty cells Set to true (the default) to advise the Reader read data values for all cells, irrespective of value. IReader
getIncludeCharts() Read charts in workbook? If this is true, then the Reader will include any charts that exist in the workbook. bool
setIncludeCharts() Set read charts in workbook Set to true, to advise the Reader to include any charts that exist in the workbook. IReader
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. mixed
setLoadSheetsOnly() Set which sheets to load. IReader
setLoadAllSheets() Set all sheets to load Tells the Reader to load all worksheets from the workbook. IReader
getReadFilter() Read filter. IReadFilter
setReadFilter() Set read filter. IReader
getSecurityScanner() mixed
openFile() Open file for reading. void

Constants

NAMESPACE_GNM

mixed $NAMESPACE_GNM = 'http://www.gnumeric.org/v10.dtd'

NAMESPACE_XSI

mixed $NAMESPACE_XSI = 'http://www.w3.org/2001/XMLSchema-instance'

NAMESPACE_OFFICE

mixed $NAMESPACE_OFFICE = 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'

NAMESPACE_XLINK

mixed $NAMESPACE_XLINK = 'http://www.w3.org/1999/xlink'

NAMESPACE_DC

mixed $NAMESPACE_DC = 'http://purl.org/dc/elements/1.1/'

NAMESPACE_META

mixed $NAMESPACE_META = 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'

NAMESPACE_OOO

mixed $NAMESPACE_OOO = 'http://openoffice.org/2004/office'

Properties

$expressions

Shared Expressions.

private array $expressions = []

$spreadsheet

Spreadsheet shared across all functions.

private Spreadsheet $spreadsheet

$mappings

public static array $mappings = ['dataType' => [ '10' => \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NULL, '20' => \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_BOOL, '30' => \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC, // Integer doesn't exist in Excel '40' => \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC, // Float '50' => \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_ERROR, '60' => \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING, ]]

$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 cells all cells, or should ignore cells containing null value or empty string.

protected bool $readEmptyCells = true

$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|string[] $loadSheetsOnly

Methods

__construct()

Create a new Gnumeric.

public __construct( ) : mixed
Return values
mixed

canRead()

Can the current IReader read the file?

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

matchXml()

private static matchXml( $xml : XMLReader , $expectedLocalName : string ) : bool
Parameters
$xml : XMLReader
$expectedLocalName : string
Return values
bool

listWorksheetNames()

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

public listWorksheetNames( $pFilename : string ) : array
Parameters
$pFilename : string
Return values
array

listWorksheetInfo()

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

public listWorksheetInfo( $pFilename : string ) : array
Parameters
$pFilename : string
Return values
array

gzfileGetContents()

private gzfileGetContents( $filename : string ) : string
Parameters
$filename : string
Return values
string

gnumericMappings()

public static gnumericMappings( ) : array
Return values
array

processComments()

private processComments( $sheet : SimpleXMLElement ) : void
Parameters
$sheet : SimpleXMLElement

testSimpleXml()

private static testSimpleXml( $value : mixed ) : SimpleXMLElement
Parameters
$value : mixed
Return values
SimpleXMLElement

load()

Loads Spreadsheet from file.

public load( $pFilename : string ) : Spreadsheet
Parameters
$pFilename : string
Return values
Spreadsheet

loadIntoExisting()

Loads from file into Spreadsheet instance.

public loadIntoExisting( $pFilename : string , $spreadsheet : Spreadsheet ) : Spreadsheet
Parameters
$pFilename : string
$spreadsheet : Spreadsheet
Return values
Spreadsheet

processMergedCells()

private processMergedCells( $sheet : SimpleXMLElement|null ) : void
Parameters
$sheet : SimpleXMLElement|null

processAutofilter()

private processAutofilter( $sheet : SimpleXMLElement|null ) : void
Parameters
$sheet : SimpleXMLElement|null

setColumnWidth()

private setColumnWidth( $whichColumn : int , $defaultWidth : float ) : void
Parameters
$whichColumn : int
$defaultWidth : float

setColumnInvisible()

private setColumnInvisible( $whichColumn : int ) : void
Parameters
$whichColumn : int

processColumnLoop()

private processColumnLoop( $whichColumn : int , $maxCol : int , $columnOverride : SimpleXMLElement , $defaultWidth : float ) : int
Parameters
$whichColumn : int
$maxCol : int
$columnOverride : SimpleXMLElement
$defaultWidth : float
Return values
int

processColumnWidths()

private processColumnWidths( $sheet : SimpleXMLElement|null , $maxCol : int ) : void
Parameters
$sheet : SimpleXMLElement|null
$maxCol : int

setRowHeight()

private setRowHeight( $whichRow : int , $defaultHeight : float ) : void
Parameters
$whichRow : int
$defaultHeight : float

setRowInvisible()

private setRowInvisible( $whichRow : int ) : void
Parameters
$whichRow : int

processRowLoop()

private processRowLoop( $whichRow : int , $maxRow : int , $rowOverride : SimpleXMLElement , $defaultHeight : float ) : int
Parameters
$whichRow : int
$maxRow : int
$rowOverride : SimpleXMLElement
$defaultHeight : float
Return values
int

processRowHeights()

private processRowHeights( $sheet : SimpleXMLElement|null , $maxRow : int ) : void
Parameters
$sheet : SimpleXMLElement|null
$maxRow : int

processDefinedNames()

private processDefinedNames( $gnmXML : SimpleXMLElement|null ) : void
Parameters
$gnmXML : SimpleXMLElement|null

__construct()

IReader constructor.

public __construct( ) : mixed
Return values
mixed

getReadDataOnly()

Read data only? If this is true, then the Reader will only read data values for cells, it will not read any formatting information.

public getReadDataOnly( ) : bool

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

Return values
bool

setReadDataOnly()

Set read data only Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.

public setReadDataOnly( $pValue : mixed ) : IReader

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

Parameters
$pValue : mixed
Return values
IReader

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

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( $pValue : mixed ) : IReader

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

Parameters
$pValue : mixed
Return values
IReader

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

setIncludeCharts()

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

public setIncludeCharts( $pValue : mixed ) : IReader

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
$pValue : mixed
Return values
IReader

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( ) : mixed
Return values
mixed

setLoadSheetsOnly()

Set which sheets to load.

public setLoadSheetsOnly( $value : mixed ) : IReader
Parameters
$value : mixed

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

Return values
IReader

setLoadAllSheets()

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

public setLoadAllSheets( ) : IReader
Return values
IReader

getSecurityScanner()

public getSecurityScanner( ) : mixed
Return values
mixed

openFile()

Open file for reading.

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

Search results