Source for file Alignment.php
Documentation is available at Alignment.php 
 * Copyright (c) 2006 - 2011 PHPExcel  
 * This library is free software; you can redistribute it and/or  
 * modify it under the terms of the GNU Lesser General Public  
 * License as published by the Free Software Foundation; either  
 * version 2.1 of the License, or (at your option) any later version.  
 * This library is distributed in the hope that it will be useful,  
 * but WITHOUT ANY WARRANTY; without even the implied warranty of  
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  
 * Lesser General Public License for more details.  
 * You should have received a copy of the GNU Lesser General Public  
 * License along with this library; if not, write to the Free Software  
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA  
 * @package    PHPExcel_Style  
 * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)  
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL  
 * @version    1.7.6, 2011-02-27  
 * PHPExcel_Style_Alignment  
 * @package    PHPExcel_Style  
 * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)  
    /* Horizontal alignment styles */  
    const HORIZONTAL_GENERAL                =  'general';  
    const HORIZONTAL_LEFT                    =  'left';  
    const HORIZONTAL_RIGHT                    =  'right';  
    const HORIZONTAL_CENTER                    =  'center';  
    const HORIZONTAL_CENTER_CONTINUOUS        =  'centerContinuous';  
    const HORIZONTAL_JUSTIFY                =  'justify';  
    /* Vertical alignment styles */  
    const VERTICAL_BOTTOM                    =  'bottom';  
    const VERTICAL_TOP                        =  'top';  
    const VERTICAL_CENTER                    =  'center';  
    const VERTICAL_JUSTIFY                    =  'justify';  
    private $_horizontal    =  PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;  
    private $_vertical        =  PHPExcel_Style_Alignment::VERTICAL_BOTTOM;  
    private $_textRotation    =  0;  
    private $_wrapText        =  false;  
    private $_shrinkToFit    =  false;  
     * Indent - only possible with horizontal alignment left and right  
     * @var _parentPropertyName string  
    private $_parentPropertyName;  
     * Parent. Only used for supervisor  
     * Create a new PHPExcel_Style_Alignment  
        $this->_isSupervisor =  $isSupervisor;  
     * Bind parent. Only used for supervisor  
     * @param PHPExcel $parent   
     * @return PHPExcel_Style_Alignment   
        $this->_parent =  $parent;  
     * Is this a supervisor or a real style component?  
        return $this->_isSupervisor;  
     * Get the shared style component for the currently active cell in currently active sheet.  
     * Only used for style supervisor  
     * @return PHPExcel_Style_Alignment   
     * Get the currently active sheet. Only used for supervisor  
     * @return PHPExcel_Worksheet   
     * Get the currently active cell coordinate in currently active sheet.  
     * Only used for supervisor  
     * @return string E.g. 'A1'  
     * Get the currently active cell coordinate in currently active sheet.  
     * Only used for supervisor  
     * @return string E.g. 'A1'  
     * Build style array from subcomponents  
        return array('alignment' =>  $array);  
     * Apply styles from array  
     * $objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray(  
     *            'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,  
     *            'vertical'   => PHPExcel_Style_Alignment::VERTICAL_CENTER,  
     * @param    array    $pStyles    Array containing style information  
     * @return PHPExcel_Style_Alignment   
            if ($this->_isSupervisor) {  
            throw  new Exception("Invalid style array passed."); 
        if ($this->_isSupervisor) {  
        return $this->_horizontal;  
     * @return PHPExcel_Style_Alignment   
    public function setHorizontal($pValue =  PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) {  
        if ($this->_isSupervisor) {  
            $styleArray =  $this->getStyleArray(array('horizontal' =>  $pValue));  
            $this->_horizontal =  $pValue;  
        if ($this->_isSupervisor) {  
     * @return PHPExcel_Style_Alignment   
    public function setVertical($pValue =  PHPExcel_Style_Alignment::VERTICAL_BOTTOM) {  
        if ($this->_isSupervisor) {  
            $styleArray =  $this->getStyleArray(array('vertical' =>  $pValue));  
            $this->_vertical =  $pValue;  
        if ($this->_isSupervisor) {  
        return $this->_textRotation;  
     * @return PHPExcel_Style_Alignment   
        // Excel2007 value 255 => PHPExcel value -165  
        if ( ($pValue >= - 90 &&  $pValue <=  90) ||  $pValue == - 165 ) {  
            if ($this->_isSupervisor) {  
                $styleArray =  $this->getStyleArray(array('rotation' =>  $pValue));  
                $this->_textRotation =  $pValue;  
            throw  new Exception("Text rotation should be a value between -90 and 90."); 
        if ($this->_isSupervisor) {  
     * @return PHPExcel_Style_Alignment   
        if ($this->_isSupervisor) {  
            $this->_wrapText =  $pValue;  
        if ($this->_isSupervisor) {  
        return $this->_shrinkToFit;  
     * @return PHPExcel_Style_Alignment   
        if ($this->_isSupervisor) {  
            $styleArray =  $this->getStyleArray(array('shrinkToFit' =>  $pValue));  
            $this->_shrinkToFit =  $pValue;  
        if ($this->_isSupervisor) {  
     * @return PHPExcel_Style_Alignment   
                $pValue =  0; // indent not supported  
        if ($this->_isSupervisor) {  
            $this->_indent =  $pValue;  
     * @return string    Hash code  
        if ($this->_isSupervisor) {  
            .  ($this->_wrapText ?  't' :  'f') 
            .  ($this->_shrinkToFit ?  't' :  'f') 
     * Implement PHP __clone to create a deep clone, not just a shallow copy.  
        foreach ($vars as $key =>  $value) {  
            if ((is_object($value)) &&  ($key !=  '_parent')) {  
                $this->$key =  clone $value;  
 
 
        
       |