PHPExcel Style Reference: Complete List of PHPExcel Style Attributes and Properties

Here is every possible combination cell styles for PHPExcel 5.3. The simplest way to set the style of a PHPExcel object is to retrieve the desired style object and use the applyFromArray() function. This is the list of acceptable parameters for the applyFromArray() function to make that task simpler. This list comes straight from the PHPExcel source code.


/*** PHPExcel Object ***/

    /* Get the default Style object */
    (PHPExcel_Style) $style = ((PHPExcel) $excel)->getDefaultStyle()


/*** PHPExcel_Cell Object ***/

    /* Get the Style object for a Cell */
    (PHPExcel_Style) $style = ((PHPExcel) $excel)->getStyle('A1')


/*** Styles ***/

    /* Apply new Style from array */
    $style->applyFromArray(
        array(
            'alignment' => array(
                'horizontal' =>
                    PHPExcel_Style_Alignment::HORIZONTAL_GENERAL           = 'general'
                    PHPExcel_Style_Alignment::HORIZONTAL_LEFT              = 'left'
                    PHPExcel_Style_Alignment::HORIZONTAL_RIGHT             = 'right'
                    PHPExcel_Style_Alignment::HORIZONTAL_CENTER            = 'center'
                    PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous'
                    PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY           = 'justify'
                'vertical' =>
                    PHPExcel_Style_Alignment::VERTICAL_BOTTOM  = 'bottom'
                    PHPExcel_Style_Alignment::VERTICAL_TOP     = 'top'
                    PHPExcel_Style_Alignment::VERTICAL_CENTER  = 'center'
                    PHPExcel_Style_Alignment::VERTICAL_JUSTIFY = 'justify'
                'rotation' => (int)
                'wrap' => (boolean)
                'shrinkToFit' => (boolean)
                'indent' => (int)
            )
            'borders' => array(
                'allborders' => array(
                    'style' =>
                        PHPExcel_Style_Border::BORDER_NONE               = 'none';
                        PHPExcel_Style_Border::BORDER_DASHDOT            = 'dashDot';
                        PHPExcel_Style_Border::BORDER_DASHDOTDOT         = 'dashDotDot';
                        PHPExcel_Style_Border::BORDER_DASHED             = 'dashed';
                        PHPExcel_Style_Border::BORDER_DOTTED             = 'dotted';
                        PHPExcel_Style_Border::BORDER_DOUBLE             = 'double';
                        PHPExcel_Style_Border::BORDER_HAIR               = 'hair';
                        PHPExcel_Style_Border::BORDER_MEDIUM             = 'medium';
                        PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT      = 'mediumDashDot';
                        PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT   = 'mediumDashDotDot';
                        PHPExcel_Style_Border::BORDER_MEDIUMDASHED       = 'mediumDashed';
                        PHPExcel_Style_Border::BORDER_SLANTDASHDOT       = 'slantDashDot';
                        PHPExcel_Style_Border::BORDER_THICK              = 'thick';
                        PHPExcel_Style_Border::BORDER_THIN               = 'thin';
                    'color' => array(
                        'rgb' =>
                            PHPExcel_Style_Color::COLOR_BLACK            = 'FF000000';
                            PHPExcel_Style_Color::COLOR_WHITE            = 'FFFFFFFF';
                            PHPExcel_Style_Color::COLOR_RED              = 'FFFF0000';
                            PHPExcel_Style_Color::COLOR_DARKRED          = 'FF800000';
                            PHPExcel_Style_Color::COLOR_BLUE             = 'FF0000FF';
                            PHPExcel_Style_Color::COLOR_DARKBLUE         = 'FF000080';
                            PHPExcel_Style_Color::COLOR_GREEN            = 'FF00FF00';
                            PHPExcel_Style_Color::COLOR_DARKGREEN        = 'FF008000';
                            PHPExcel_Style_Color::COLOR_YELLOW           = 'FFFFFF00';
                            PHPExcel_Style_Color::COLOR_DARKYELLOW       = 'FF808000';
                    )
                              
                )
                'left' => // See 'allborders'
                'top' => // See 'allborders'
                'right' => // See 'allborders'
                'bottom' => // See 'allborders'
                'diagonal' =>
                'diagonaldirection' =>
            )
            'fill' => array(
                'type' =>
                    PHPExcel_Style_Fill::FILL_NONE                         = 'none';
                    PHPExcel_Style_Fill::FILL_SOLID                        = 'solid';
                    PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR              = 'linear';
                    PHPExcel_Style_Fill::FILL_GRADIENT_PATH                = 'path';
                    PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN             = 'darkDown';
                    PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY             = 'darkGray';
                    PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID             = 'darkGrid';
                    PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL       = 'darkHorizontal';
                    PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS          = 'darkTrellis';
                    PHPExcel_Style_Fill::FILL_PATTERN_DARKUP               = 'darkUp';
                    PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL         = 'darkVertical';
                    PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625             = 'gray0625';
                    PHPExcel_Style_Fill::FILL_PATTERN_GRAY125              = 'gray125';
                    PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN            = 'lightDown';
                    PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY            = 'lightGray';
                    PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID            = 'lightGrid';
                    PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL      = 'lightHorizontal';
                    PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS         = 'lightTrellis';
                    PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP              = 'lightUp';
                    PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL        = 'lightVertical';
                    PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY           = 'mediumGray';
                'rotation' => (double)
                'startcolor' => // See 'borders' => 'allborders' => 'color'
                'endcolor' => // See 'borders' => 'allborders' => 'color'
                'color' => // See 'borders' => 'allborders' => 'color'
            )
            'font' => array(
                'name' =>
                    'Arial'
                    'Calibri'
                    // etc.
                'bold' => (boolean)
                'italic' => (boolean)
                'superScript' => (boolean)
                'subScript' => (boolean)
                'underline' => (boolean)
                'strike' => (boolean)
                'size' => (float)
                'color' => // See 'borders' => 'allborders' => 'color'
            )
            'numberformat' =>
            'protection' =>
        )
    )

10 comments:

  1. great !! that's just I need. thanks so much.

    ReplyDelete
  2. It is simple but it is technical one, every thing is available on computer, every student should know about PHP, if students learn this language then it will good for students, they can make their own links on computer. The biggest problem they have is neck pain as they have to sit hours in front of computer to make new softwares and need in return help from neck pain Canberra to have cure of their neck pain.

    ReplyDelete
  3. The complete list of properties and other important things is really an amazing uk best essays for all the people because in this way the people can enjoy their life. I hope that it will give a lot of satisfaction to all the people.

    ReplyDelete
  4. simple, complete, perfect! Thanks sir

    ReplyDelete
  5. Simple and unbelievable post, that's what I needed! Thank you for posting! Sorry for translator's English, I do not speak English.

    ReplyDelete
  6. There is an error in your notation for color: PHPExcel is using AlphaRGB ie: 'FF000000' not '000000' for white. The array should therefore be

    'color' => array(
    'argb' => PPExcel_Style_Color::COLOR_BLACK;

    ReplyDelete
  7. Hi guys! How to align a text in the center of the cell please?

    ReplyDelete
  8. Have you test this code? Because I was stuck and searching something like this for my company logo design service website. So it could be good for me if someone has already tested it which save my time.

    ReplyDelete