PHPExcel_Worksheet
[ class tree: PHPExcel_Worksheet ] [ index: PHPExcel_Worksheet ] [ all elements ]

Source for file ColumnDimension.php

Documentation is available at ColumnDimension.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2009 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel_Worksheet
  23.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.0, 2009-08-10
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPExcel_Worksheet_ColumnDimension
  31.  *
  32.  * @category   PHPExcel
  33.  * @package    PHPExcel_Worksheet
  34.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  35.  */
  36. {            
  37.     /**
  38.      * Column index
  39.      *
  40.      * @var int 
  41.      */
  42.     private $_columnIndex;
  43.     
  44.     /**
  45.      * Column width
  46.      *
  47.      * When this is set to a negative value, the column width should be ignored by IWriter
  48.      *
  49.      * @var double 
  50.      */
  51.     private $_width;
  52.     
  53.     /**
  54.      * Auto size?
  55.      *
  56.      * @var bool 
  57.      */
  58.     private $_autoSize;
  59.     
  60.     /**
  61.      * Visible?
  62.      *
  63.      * @var bool 
  64.      */
  65.     private $_visible;
  66.     
  67.     /**
  68.      * Outline level
  69.      *
  70.      * @var int 
  71.      */
  72.     private $_outlineLevel = 0;
  73.     
  74.     /**
  75.      * Collapsed
  76.      *
  77.      * @var bool 
  78.      */
  79.     private $_collapsed;
  80.         
  81.     /**
  82.      * Create a new PHPExcel_Worksheet_RowDimension
  83.      *
  84.      * @param string $pIndex Character column index
  85.      */
  86.     public function __construct($pIndex 'A')
  87.     {
  88.         // Initialise values
  89.         $this->_columnIndex        = $pIndex;
  90.         $this->_width            = -1;
  91.         $this->_autoSize        = false;
  92.         $this->_visible            = true;
  93.         $this->_outlineLevel    = 0;
  94.         $this->_collapsed        = false;
  95.     }
  96.     
  97.     /**
  98.      * Get ColumnIndex
  99.      *
  100.      * @return string 
  101.      */
  102.     public function getColumnIndex({
  103.         return $this->_columnIndex;
  104.     }
  105.     
  106.     /**
  107.      * Set ColumnIndex
  108.      *
  109.      * @param string $pValue 
  110.      * @return PHPExcel_Worksheet_ColumnDimension 
  111.      */
  112.     public function setColumnIndex($pValue{
  113.         $this->_columnIndex = $pValue;
  114.         return $this;
  115.     }
  116.     
  117.     /**
  118.      * Get Width
  119.      *
  120.      * @return double 
  121.      */
  122.     public function getWidth({
  123.         return $this->_width;
  124.     }
  125.     
  126.     /**
  127.      * Set Width
  128.      *
  129.      * @param double $pValue 
  130.      * @return PHPExcel_Worksheet_ColumnDimension 
  131.      */
  132.     public function setWidth($pValue = -1{
  133.         $this->_width = $pValue;
  134.         return $this;
  135.     }
  136.     
  137.     /**
  138.      * Get Auto Size
  139.      *
  140.      * @return bool 
  141.      */
  142.     public function getAutoSize({
  143.         return $this->_autoSize;
  144.     }
  145.     
  146.     /**
  147.      * Set Auto Size
  148.      *
  149.      * @param bool $pValue 
  150.      * @return PHPExcel_Worksheet_ColumnDimension 
  151.      */
  152.     public function setAutoSize($pValue false{
  153.         $this->_autoSize = $pValue;
  154.         return $this;
  155.     }
  156.     
  157.     /**
  158.      * Get Visible
  159.      *
  160.      * @return bool 
  161.      */
  162.     public function getVisible({
  163.         return $this->_visible;
  164.     }
  165.     
  166.     /**
  167.      * Set Visible
  168.      *
  169.      * @param bool $pValue 
  170.      * @return PHPExcel_Worksheet_ColumnDimension 
  171.      */
  172.     public function setVisible($pValue true{
  173.         $this->_visible = $pValue;
  174.         return $this;
  175.     }
  176.     
  177.     /**
  178.      * Get Outline Level
  179.      *
  180.      * @return int 
  181.      */
  182.     public function getOutlineLevel({
  183.         return $this->_outlineLevel;
  184.     }
  185.     
  186.     /**
  187.      * Set Outline Level
  188.      *
  189.      * Value must be between 0 and 7
  190.      *
  191.      * @param int $pValue 
  192.      * @throws Exception
  193.      * @return PHPExcel_Worksheet_ColumnDimension 
  194.      */
  195.     public function setOutlineLevel($pValue{
  196.         if ($pValue || $pValue 7{
  197.             throw new Exception("Outline level must range between 0 and 7.");
  198.         }
  199.         
  200.         $this->_outlineLevel = $pValue;
  201.         return $this;
  202.     }
  203.     
  204.     /**
  205.      * Get Collapsed
  206.      *
  207.      * @return bool 
  208.      */
  209.     public function getCollapsed({
  210.         return $this->_collapsed;
  211.     }
  212.     
  213.     /**
  214.      * Set Collapsed
  215.      *
  216.      * @param bool $pValue 
  217.      * @return PHPExcel_Worksheet_ColumnDimension 
  218.      */
  219.     public function setCollapsed($pValue true{
  220.         $this->_collapsed = $pValue;
  221.         return $this;
  222.     }
  223.         
  224.     /**
  225.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  226.      */
  227.     public function __clone({
  228.         $vars get_object_vars($this);
  229.         foreach ($vars as $key => $value{
  230.             if (is_object($value)) {
  231.                 $this->$key clone $value;
  232.             else {
  233.                 $this->$key $value;
  234.             }
  235.         }
  236.     }
  237. }

Documentation generated on Mon, 10 Aug 2009 08:02:46 +0200 by phpDocumentor 1.4.1