PHP Class Box\Spout\Writer\Style\Style

Exibir arquivo Open project: box/spout Class Usage Examples

Protected Properties

Property Type Description
$backgroundColor Background color
$border Box\Spout\Writer\Style\Border
$fontBold Whether the font should be bold
$fontColor Font color
$fontItalic Whether the font should be italic
$fontName Font name
$fontSize Font size
$fontStrikethrough Whether the font should be struck through
$fontUnderline Whether the font should be underlined
$hasSetBackgroundColor boolean
$hasSetFontBold Whether the bold property was set
$hasSetFontColor Whether the font color property was set
$hasSetFontItalic Whether the italic property was set
$hasSetFontName Whether the font name property was set
$hasSetFontSize Whether the font size property was set
$hasSetFontStrikethrough Whether the strikethrough property was set
$hasSetFontUnderline Whether the underline property was set
$hasSetWrapText Whether the wrap text property was set
$id Style ID
$shouldApplyBorder Whether border properties should be applied
$shouldApplyFont Whether specific font properties should be applied
$shouldWrapText Whether the text should wrap in the cell (useful for long or multi-lines text)

Public Methods

Method Description
getBackgroundColor ( ) : string
getBorder ( ) : Box\Spout\Writer\Style\Border
getFontColor ( ) : string
getFontName ( ) : string
getFontSize ( ) : integer
getId ( ) : integer | null
hasSetWrapText ( ) : boolean
isFontBold ( ) : boolean
isFontItalic ( ) : boolean
isFontStrikethrough ( ) : boolean
isFontUnderline ( ) : boolean
mergeWith ( Style $baseStyle ) : Style Merges the current style with the given style, using the given style as a base. This means that: - if current style and base style both have property A set, use current style property's value - if current style has property A set but base style does not, use current style property's value - if base style has property A set but current style does not, use base style property's value
serialize ( ) : string Serializes the style for future comparison with other styles.
setBackgroundColor ( string $color ) : Style Sets the background color
setBorder ( Box\Spout\Writer\Style\Border $border ) : Style
setFontBold ( ) : Style
setFontColor ( string $fontColor ) : Style Sets the font color.
setFontItalic ( ) : Style
setFontName ( string $fontName ) : Style
setFontSize ( integer $fontSize ) : Style
setFontStrikethrough ( ) : Style
setFontUnderline ( ) : Style
setId ( integer $id ) : Style
setShouldWrapText ( boolean | void $shouldWrap = true ) : Style
shouldApplyBackgroundColor ( ) : boolean
shouldApplyBorder ( ) : boolean
shouldApplyFont ( ) : boolean
shouldWrapText ( ) : boolean

Private Methods

Method Description
mergeCellProperties ( Style $styleToUpdate, Style $baseStyle ) : void
mergeFontStyles ( Style $styleToUpdate, Style $baseStyle ) : void
mergeOtherFontProperties ( Style $styleToUpdate, Style $baseStyle ) : void

Method Details

getBackgroundColor() public method

public getBackgroundColor ( ) : string
return string

getBorder() public method

public getBorder ( ) : Box\Spout\Writer\Style\Border
return Box\Spout\Writer\Style\Border

getFontColor() public method

public getFontColor ( ) : string
return string

getFontName() public method

public getFontName ( ) : string
return string

getFontSize() public method

public getFontSize ( ) : integer
return integer

getId() public method

public getId ( ) : integer | null
return integer | null

hasSetWrapText() public method

public hasSetWrapText ( ) : boolean
return boolean

isFontBold() public method

public isFontBold ( ) : boolean
return boolean

isFontItalic() public method

public isFontItalic ( ) : boolean
return boolean

isFontStrikethrough() public method

public isFontStrikethrough ( ) : boolean
return boolean

isFontUnderline() public method

public isFontUnderline ( ) : boolean
return boolean

mergeWith() public method

Merges the current style with the given style, using the given style as a base. This means that: - if current style and base style both have property A set, use current style property's value - if current style has property A set but base style does not, use current style property's value - if base style has property A set but current style does not, use base style property's value
public mergeWith ( Style $baseStyle ) : Style
$baseStyle Style
return Style New style corresponding to the merge of the 2 styles

serialize() public method

The ID is excluded from the comparison, as we only care about actual style properties.
public serialize ( ) : string
return string The serialized style

setBackgroundColor() public method

Sets the background color
public setBackgroundColor ( string $color ) : Style
$color string ARGB color (@see Color)
return Style

setBorder() public method

public setBorder ( Box\Spout\Writer\Style\Border $border ) : Style
$border Box\Spout\Writer\Style\Border
return Style

setFontBold() public method

public setFontBold ( ) : Style
return Style

setFontColor() public method

Sets the font color.
public setFontColor ( string $fontColor ) : Style
$fontColor string ARGB color (@see Color)
return Style

setFontItalic() public method

public setFontItalic ( ) : Style
return Style

setFontName() public method

public setFontName ( string $fontName ) : Style
$fontName string Name of the font to use
return Style

setFontSize() public method

public setFontSize ( integer $fontSize ) : Style
$fontSize integer Font size, in pixels
return Style

setFontStrikethrough() public method

public setFontStrikethrough ( ) : Style
return Style

setFontUnderline() public method

public setFontUnderline ( ) : Style
return Style

setId() public method

public setId ( integer $id ) : Style
$id integer
return Style

setShouldWrapText() public method

public setShouldWrapText ( boolean | void $shouldWrap = true ) : Style
$shouldWrap boolean | void Should the text be wrapped
return Style

shouldApplyBackgroundColor() public method

public shouldApplyBackgroundColor ( ) : boolean
return boolean Whether the background color should be applied

shouldApplyBorder() public method

public shouldApplyBorder ( ) : boolean
return boolean

shouldApplyFont() public method

public shouldApplyFont ( ) : boolean
return boolean Whether specific font properties should be applied

shouldWrapText() public method

public shouldWrapText ( ) : boolean
return boolean

Property Details

$backgroundColor protected_oe property

Background color
protected $backgroundColor

$border protected_oe property

protected Border,Box\Spout\Writer\Style $border
return Box\Spout\Writer\Style\Border

$fontBold protected_oe property

Whether the font should be bold
protected $fontBold

$fontColor protected_oe property

Font color
protected $fontColor

$fontItalic protected_oe property

Whether the font should be italic
protected $fontItalic

$fontName protected_oe property

Font name
protected $fontName

$fontSize protected_oe property

Font size
protected $fontSize

$fontStrikethrough protected_oe property

Whether the font should be struck through
protected $fontStrikethrough

$fontUnderline protected_oe property

Whether the font should be underlined
protected $fontUnderline

$hasSetBackgroundColor protected_oe property

protected bool $hasSetBackgroundColor
return boolean

$hasSetFontBold protected_oe property

Whether the bold property was set
protected $hasSetFontBold

$hasSetFontColor protected_oe property

Whether the font color property was set
protected $hasSetFontColor

$hasSetFontItalic protected_oe property

Whether the italic property was set
protected $hasSetFontItalic

$hasSetFontName protected_oe property

Whether the font name property was set
protected $hasSetFontName

$hasSetFontSize protected_oe property

Whether the font size property was set
protected $hasSetFontSize

$hasSetFontStrikethrough protected_oe property

Whether the strikethrough property was set
protected $hasSetFontStrikethrough

$hasSetFontUnderline protected_oe property

Whether the underline property was set
protected $hasSetFontUnderline

$hasSetWrapText protected_oe property

Whether the wrap text property was set
protected $hasSetWrapText

$id protected_oe property

Style ID
protected $id

$shouldApplyBorder protected_oe property

Whether border properties should be applied
protected $shouldApplyBorder

$shouldApplyFont protected_oe property

Whether specific font properties should be applied
protected $shouldApplyFont

$shouldWrapText protected_oe property

Whether the text should wrap in the cell (useful for long or multi-lines text)
protected $shouldWrapText