Constants

STRING_REGEXP_FRACTION

STRING_REGEXP_FRACTION = '(-?)(\d+)\s+(\d+\/\d+)'

Properties

$_controlCharacters

$_controlCharacters : array<mixed,string>

Control characters array

Type

array<mixed,string>

$_SYLKCharacters

$_SYLKCharacters : 

SYLK Characters array

$var array

Type

$_decimalSeparator

$_decimalSeparator : string

Decimal separator

Type

string

$_thousandsSeparator

$_thousandsSeparator : string

Thousands separator

Type

string

$_currencyCode

$_currencyCode : string

Currency code

Type

string

$_isMbstringEnabled

$_isMbstringEnabled : boolean

Is mbstring extension avalable?

Type

boolean

$_isIconvEnabled

$_isIconvEnabled : boolean

Is iconv extension avalable?

Type

boolean

Methods

getIsMbstringEnabled()

getIsMbstringEnabled() : boolean

Get whether mbstring extension is available

Returns

boolean

getIsIconvEnabled()

getIsIconvEnabled() : boolean

Get whether iconv extension is available

Returns

boolean

buildCharacterSets()

buildCharacterSets() 

ControlCharacterOOXML2PHP()

ControlCharacterOOXML2PHP(string  $value = '') : string

Convert from OpenXML escaped control character to PHP control character

Excel 2007 team:

That's correct, control characters are stored directly in the shared-strings table. We do encode characters that cannot be represented in XML using the following escape sequence: xHHHH where H represents a hexadecimal character in the character's value... So you could end up with something like x0008 in a string (either in a cell value () element or in the shared string element.

Parameters

string $value

Value to unescape

Returns

string

ControlCharacterPHP2OOXML()

ControlCharacterPHP2OOXML(string  $value = '') : string

Convert from PHP control character to OpenXML escaped control character

Excel 2007 team:

That's correct, control characters are stored directly in the shared-strings table. We do encode characters that cannot be represented in XML using the following escape sequence: xHHHH where H represents a hexadecimal character in the character's value... So you could end up with something like x0008 in a string (either in a cell value () element or in the shared string element.

Parameters

string $value

Value to escape

Returns

string

SanitizeUTF8()

SanitizeUTF8(string  $value) : string

Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters.

Parameters

string $value

Returns

string

IsUTF8()

IsUTF8(string  $value = '') : boolean

Check if a string contains UTF8 data

Parameters

string $value

Returns

boolean

FormatNumber()

FormatNumber(mixed  $value) : string

Formats a numeric value as a string for output in various output writers forcing point as decimal separator in case locale is other than English.

Parameters

mixed $value

Returns

string

UTF8toBIFF8UnicodeShort()

UTF8toBIFF8UnicodeShort(string  $value, array<mixed,mixed>  $arrcRuns = array()) : string

Converts a UTF-8 string into BIFF8 Unicode string data (8-bit string length) Writes the string using uncompressed notation, no rich text, no Asian phonetics If mbstring extension is not available, ASCII is assumed, and compressed notation is used although this will give wrong results for non-ASCII strings see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3

Parameters

string $value

UTF-8 encoded string

array<mixed,mixed> $arrcRuns

Details of rich text runs in $value

Returns

string

UTF8toBIFF8UnicodeLong()

UTF8toBIFF8UnicodeLong(string  $value) : string

Converts a UTF-8 string into BIFF8 Unicode string data (16-bit string length) Writes the string using uncompressed notation, no rich text, no Asian phonetics If mbstring extension is not available, ASCII is assumed, and compressed notation is used although this will give wrong results for non-ASCII strings see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3

Parameters

string $value

UTF-8 encoded string

Returns

string

ConvertEncoding()

ConvertEncoding(string  $value, string  $to, string  $from) : string

Convert string from one encoding to another. First try mbstring, then iconv, finally strlen

Parameters

string $value
string $to

Encoding to convert to, e.g. 'UTF-8'

string $from

Encoding to convert from, e.g. 'UTF-16LE'

Returns

string

utf16_decode()

utf16_decode(string  $str,   $bom_be = TRUE) : string

Decode UTF-16 encoded strings.

Can handle both BOM'ed data and un-BOM'ed data. Assumes Big-Endian byte order if no BOM is available. This function was taken from http://php.net/manual/en/function.utf8-decode.php and $bom_be parameter added.

Parameters

string $str

UTF-16 encoded data to decode.

$bom_be

Returns

string —

UTF-8 / ISO encoded data.

CountCharacters()

CountCharacters(string  $value, string  $enc = 'UTF-8') : integer

Get character count. First try mbstring, then iconv, finally strlen

Parameters

string $value
string $enc

Encoding

Returns

integer —

Character count

Substring()

Substring(string  $pValue = '', integer  $pStart, integer  $pLength) : string

Get a substring of a UTF-8 encoded string. First try mbstring, then iconv, finally strlen

Parameters

string $pValue

UTF-8 encoded string

integer $pStart

Start offset

integer $pLength

Maximum number of characters in substring

Returns

string

StrToUpper()

StrToUpper(string  $pValue = '') : string

Convert a UTF-8 encoded string to upper case

Parameters

string $pValue

UTF-8 encoded string

Returns

string

StrToLower()

StrToLower(string  $pValue = '') : string

Convert a UTF-8 encoded string to lower case

Parameters

string $pValue

UTF-8 encoded string

Returns

string

StrToTitle()

StrToTitle(string  $pValue = '') : string

Convert a UTF-8 encoded string to title/proper case (uppercase every first character in each word, lower case all other characters)

Parameters

string $pValue

UTF-8 encoded string

Returns

string

mb_is_upper()

mb_is_upper(  $char) 

Parameters

$char

mb_str_split()

mb_str_split(  $string) 

Parameters

$string

StrCaseReverse()

StrCaseReverse(string  $pValue = '') : string

Reverse the case of a string, so that all uppercase characters become lowercase and all lowercase characters become uppercase

Parameters

string $pValue

UTF-8 encoded string

Returns

string

convertToNumberIfFraction()

convertToNumberIfFraction(  $operand) : boolean

Identify whether a string contains a fractional numeric value, and convert it to a numeric if it is

Parameters

$operand

Returns

boolean

getDecimalSeparator()

getDecimalSeparator() : string

Get the decimal separator. If it has not yet been set explicitly, try to obtain number formatting information from locale.

Returns

string

setDecimalSeparator()

setDecimalSeparator(string  $pValue = '.') 

Set the decimal separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF

Parameters

string $pValue

Character for decimal separator

getThousandsSeparator()

getThousandsSeparator() : string

Get the thousands separator. If it has not yet been set explicitly, try to obtain number formatting information from locale.

Returns

string

setThousandsSeparator()

setThousandsSeparator(string  $pValue = ',') 

Set the thousands separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF

Parameters

string $pValue

Character for thousands separator

getCurrencyCode()

getCurrencyCode() : string

Get the currency code. If it has not yet been set explicitly, try to obtain the symbol information from locale.

Returns

string

setCurrencyCode()

setCurrencyCode(string  $pValue = '$') 

Set the currency code. Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF

Parameters

string $pValue

Character for currency code

SYLKtoUTF8()

SYLKtoUTF8(string  $pValue = '') : string

Convert SYLK encoded string to UTF-8

Parameters

string $pValue

Returns

string —

UTF-8 encoded string

testStringAsNumeric()

testStringAsNumeric(string  $value) : mixed

Retrieve any leading numeric part of a string, or return the full string if no leading numeric (handles basic integer or float, but not exponent or non decimal)

Parameters

string $value

Returns

mixed —

string or only the leading numeric part of the string

_buildControlCharacters()

_buildControlCharacters() 

Build control characters array

_buildSYLKCharacters()

_buildSYLKCharacters() 

Build SYLK characters array