PHP 클래스 Box\Spout\Reader\XLSX\Helper\StyleHelper

파일 보기 프로젝트 열기: box/spout

보호된 프로퍼티들

프로퍼티 타입 설명
$builtinNumFmtIdIndicatingDates Array containing the IDs of built-in number formats indicating a date
$builtinNumFmtIdToNumFormatMapping Mapping between built-in numFmtId and the associated format - for dates only
$customNumberFormats Array containing a mapping NUM_FMT_ID => FORMAT_CODE
$filePath Path of the XLSX file being read
$numFmtIdToIsDateFormatCache Cache containing a mapping NUM_FMT_ID => IS_DATE_FORMAT. Used to avoid lots of recalculations
$stylesAttributes Array containing a mapping STYLE_ID => [STYLE_ATTRIBUTES]

공개 메소드들

메소드 설명
__construct ( string $filePath )
getNumberFormatCode ( integer $styleId ) : string Returns the format as defined in "styles.xml" of the given style.
shouldFormatNumericValueAsDate ( integer $styleId ) : boolean Returns whether the style with the given ID should consider numeric values as timestamps and format the cell as a date.

보호된 메소드들

메소드 설명
doesNumFmtIdIndicateDate ( integer $numFmtId ) : boolean Returns whether the number format ID indicates that the number is a date.
doesStyleIndicateDate ( array $styleAttributes ) : boolean
extractNumberFormats ( Box\Spout\Reader\Wrapper\XMLReader $xmlReader ) : void Extracts number formats from the "numFmt" nodes.
extractRelevantInfo ( ) : void Reads the styles.xml file and extract the relevant information from the file.
extractStyleAttributes ( Box\Spout\Reader\Wrapper\XMLReader $xmlReader ) : void Extracts style attributes from the "xf" nodes, inside the "cellXfs" section.
getCustomNumberFormats ( ) : array
getFormatCodeForNumFmtId ( integer $numFmtId ) : string | null
getStylesAttributes ( ) : array
isFormatCodeCustomDateFormat ( string | null $formatCode ) : boolean
isFormatCodeMatchingDateFormatPattern ( string $formatCode ) : boolean
isNumFmtIdBuiltInDateFormat ( integer $numFmtId ) : boolean

메소드 상세

__construct() 공개 메소드

public __construct ( string $filePath )
$filePath string Path of the XLSX file being read

doesNumFmtIdIndicateDate() 보호된 메소드

The result is cached to avoid recomputing the same thing over and over, as "numFmtId" attributes can be shared between multiple styles.
protected doesNumFmtIdIndicateDate ( integer $numFmtId ) : boolean
$numFmtId integer
리턴 boolean Whether the number format ID indicates that the number is a date

doesStyleIndicateDate() 보호된 메소드

protected doesStyleIndicateDate ( array $styleAttributes ) : boolean
$styleAttributes array Array containing the style attributes (2 keys: "applyNumberFormat" and "numFmtId")
리턴 boolean Whether the style with the given attributes indicates that the number is a date

extractNumberFormats() 보호된 메소드

For simplicity, the styles attributes are kept in memory. This is possible thanks to the reuse of formats. So 1 million cells should not use 1 million formats.
protected extractNumberFormats ( Box\Spout\Reader\Wrapper\XMLReader $xmlReader ) : void
$xmlReader Box\Spout\Reader\Wrapper\XMLReader XML Reader positioned on the "numFmts" node
리턴 void

extractRelevantInfo() 보호된 메소드

Reads the styles.xml file and extract the relevant information from the file.
protected extractRelevantInfo ( ) : void
리턴 void

extractStyleAttributes() 보호된 메소드

For simplicity, the styles attributes are kept in memory. This is possible thanks to the reuse of styles. So 1 million cells should not use 1 million styles.
protected extractStyleAttributes ( Box\Spout\Reader\Wrapper\XMLReader $xmlReader ) : void
$xmlReader Box\Spout\Reader\Wrapper\XMLReader XML Reader positioned on the "cellXfs" node
리턴 void

getCustomNumberFormats() 보호된 메소드

protected getCustomNumberFormats ( ) : array
리턴 array The custom number formats

getFormatCodeForNumFmtId() 보호된 메소드

protected getFormatCodeForNumFmtId ( integer $numFmtId ) : string | null
$numFmtId integer
리턴 string | null The custom number format or NULL if none defined for the given numFmtId

getNumberFormatCode() 공개 메소드

NOTE: It is assumed that the style DOES have a number format associated to it.
public getNumberFormatCode ( integer $styleId ) : string
$styleId integer Zero-based style ID
리턴 string The number format code associated with the given style

getStylesAttributes() 보호된 메소드

protected getStylesAttributes ( ) : array
리턴 array The styles attributes

isFormatCodeCustomDateFormat() 보호된 메소드

protected isFormatCodeCustomDateFormat ( string | null $formatCode ) : boolean
$formatCode string | null
리턴 boolean Whether the given format code indicates that the number is a date

isFormatCodeMatchingDateFormatPattern() 보호된 메소드

protected isFormatCodeMatchingDateFormatPattern ( string $formatCode ) : boolean
$formatCode string
리턴 boolean Whether the given format code matches a date format pattern

isNumFmtIdBuiltInDateFormat() 보호된 메소드

protected isNumFmtIdBuiltInDateFormat ( integer $numFmtId ) : boolean
$numFmtId integer
리턴 boolean Whether the number format ID indicates that the number is a date

shouldFormatNumericValueAsDate() 공개 메소드

Returns whether the style with the given ID should consider numeric values as timestamps and format the cell as a date.
public shouldFormatNumericValueAsDate ( integer $styleId ) : boolean
$styleId integer Zero-based style ID
리턴 boolean Whether the cell with the given cell should display a date instead of a numeric value

프로퍼티 상세

$builtinNumFmtIdIndicatingDates 보호되어 있는 프로퍼티

Array containing the IDs of built-in number formats indicating a date
protected $builtinNumFmtIdIndicatingDates

$builtinNumFmtIdToNumFormatMapping 보호되어 있는 정적으로 프로퍼티

Mapping between built-in numFmtId and the associated format - for dates only
또한 보기: https://msdn.microsoft.com/en-us/library/ff529597(v=office.12).aspx
protected static $builtinNumFmtIdToNumFormatMapping

$customNumberFormats 보호되어 있는 프로퍼티

Array containing a mapping NUM_FMT_ID => FORMAT_CODE
protected $customNumberFormats

$filePath 보호되어 있는 프로퍼티

Path of the XLSX file being read
protected $filePath

$numFmtIdToIsDateFormatCache 보호되어 있는 프로퍼티

Cache containing a mapping NUM_FMT_ID => IS_DATE_FORMAT. Used to avoid lots of recalculations
protected $numFmtIdToIsDateFormatCache

$stylesAttributes 보호되어 있는 프로퍼티

Array containing a mapping STYLE_ID => [STYLE_ATTRIBUTES]
protected $stylesAttributes