PHPExcel classes » \PHPExcel_Style

PHPExcel_Style

category | PHPExcel
package | PHPExcel_Style
copyright | Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

### Methods

## Implement PHP __clone to create a deep clone, not just a shallow copy.

    __clone()

Inherited

inherited_from | \PHPExcel_Style_Supervisor::__clone()

## Create a new PHPExcel_Style

    __construct(boolean $isSupervisor, boolean $isConditional)

### Parameters

#### $isSupervisor

`boolean`

Flag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are

#### $isConditional

`boolean`

Flag indicating if this is a conditional style or not Leave this value at default unless you understand exactly what its ramifications are

## Apply styles from array

    applyFromArray(array $pStyles, boolean $pAdvanced) : \PHPExcel_Style

    $objPHPExcel->getActiveSheet()->getStyle('B2')->applyFromArray(
            array(
                'font'    => array(
                    'name'      => 'Arial',
                    'bold'      => true,
                    'italic'    => false,
                    'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE,
                    'strike'    => false,
                    'color'     => array(
                        'rgb' => '808080'
                    )
                ),
                'borders' => array(
                    'bottom'     => array(
                        'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
                        'color' => array(
                            'rgb' => '808080'
                        )
                    ),
                    'top'     => array(
                        'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
                        'color' => array(
                            'rgb' => '808080'
                        )
                    )
                ),
                'quotePrefix'    => true
            )
    );

### Parameters

#### $pStyles

`array`

Array containing style information

#### $pAdvanced

`boolean`

Advanced mode for setting borders.

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Style`

## Bind parent.

    bindParent(\PHPExcel $parent, $parentPropertyName) : \PHPExcel_Style_Supervisor

Inherited

Only used for supervisor

inherited_from | \PHPExcel_Style_Supervisor::bindParent()

### Parameters

#### $parent

`\PHPExcel`

#### $parentPropertyName

### Returns

`\PHPExcel_Style_Supervisor`

## Get the currently active cell coordinate in currently active sheet.

    getActiveCell() : string

Inherited

Only used for supervisor

inherited_from | \PHPExcel_Style_Supervisor::getActiveCell()

### Returns

`string`E.g. 'A1'

## Get the currently active sheet.

    getActiveSheet() : \PHPExcel_Worksheet

Inherited

Only used for supervisor

inherited_from | \PHPExcel_Style_Supervisor::getActiveSheet()

### Returns

`\PHPExcel_Worksheet`

## Get Alignment

    getAlignment() : \PHPExcel_Style_Alignment

### Returns

`\PHPExcel_Style_Alignment`

## Get Borders

    getBorders() : \PHPExcel_Style_Borders

### Returns

`\PHPExcel_Style_Borders`

## Get Conditional Styles.

    getConditionalStyles() : \PHPExcel_Style_Conditional[]

Only used on supervisor.

### Returns

`\PHPExcel_Style_Conditional[]`

## Get Fill

    getFill() : \PHPExcel_Style_Fill

### Returns

`\PHPExcel_Style_Fill`

## Get Font

    getFont() : \PHPExcel_Style_Font

### Returns

`\PHPExcel_Style_Font`

## Get hash code

    getHashCode() : string

### Returns

`string`Hash code

## Get own index in style collection

    getIndex() : int

### Returns

`int`

## Is this a supervisor or a cell style component?

    getIsSupervisor() : boolean

Inherited

inherited_from | \PHPExcel_Style_Supervisor::getIsSupervisor()

### Returns

`boolean`

## Get Number Format

    getNumberFormat() : \PHPExcel_Style_NumberFormat

### Returns

`\PHPExcel_Style_NumberFormat`

## Get parent.

    getParent() : \PHPExcel

Only used for style supervisor

### Returns

`\PHPExcel`

## Get Protection

    getProtection() : \PHPExcel_Style_Protection

### Returns

`\PHPExcel_Style_Protection`

## Get quote prefix

    getQuotePrefix() : boolean

### Returns

`boolean`

## Get the currently active cell coordinate in currently active sheet.

    getSelectedCells() : string

Inherited

Only used for supervisor

inherited_from | \PHPExcel_Style_Supervisor::getSelectedCells()

### Returns

`string`E.g. 'A1'

## Get the shared style component for the currently active cell in currently active sheet.

    getSharedComponent() : \PHPExcel_Style

Only used for style supervisor

### Returns

`\PHPExcel_Style`

## Build style array from subcomponents

    getStyleArray(array $array) : array

### Parameters

#### $array

`array`

### Returns

`array`

## Set Conditional Styles.

    setConditionalStyles(\PHPExcel_Style_Conditional[] $pValue) : \PHPExcel_Style

Only used on supervisor.

### Parameters

#### $pValue

`\PHPExcel_Style_Conditional[]`

Array of condtional styles

### Returns

`\PHPExcel_Style`

## Set font

    setFont(\PHPExcel_Style_Font $font) : \PHPExcel_Style

### Parameters

#### $font

`\PHPExcel_Style_Font`

### Returns

`\PHPExcel_Style`

## Set own index in style collection

    setIndex(int $pValue)

### Parameters

#### $pValue

`int`

## Set quote prefix

    setQuotePrefix(boolean $pValue)

### Parameters

#### $pValue

`boolean`

### Properties

##

    $_alignment : \PHPExcel_Style_Alignment

##

    $_borders : \PHPExcel_Style_Borders

##

    $_conditionalStyles : \PHPExcel_Style_Conditional[]

##

    $_fill : \PHPExcel_Style_Fill

##

    $_font : \PHPExcel_Style_Font

##

    $_index : int

Only used for real style.

##

    $_isSupervisor : boolean

Inherited

inherited_from | \PHPExcel_Style_Supervisor::$$_isSupervisor

##

    $_numberFormat : \PHPExcel_Style_NumberFormat

##

    $_parent : \PHPExcel_Style

Inherited

Only used for supervisor

inherited_from | \PHPExcel_Style_Supervisor::$$_parent

##

    $_protection : \PHPExcel_Style_Protection

##

    $_quotePrefix : boolean

Only used for real style.