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 - 2010 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 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.3c, 2010-06-01
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPExcel_Worksheet_ColumnDimension
  31.  *
  32.  * @category   PHPExcel
  33.  * @package    PHPExcel_Worksheet
  34.  * @copyright  Copyright (c) 2006 - 2010 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.      * Index to cellXf
  83.      *
  84.      * @var int 
  85.      */
  86.     private $_xfIndex;
  87.  
  88.     /**
  89.      * Create a new PHPExcel_Worksheet_ColumnDimension
  90.      *
  91.      * @param string $pIndex Character column index
  92.      */
  93.     public function __construct($pIndex 'A')
  94.     {
  95.         // Initialise values
  96.         $this->_columnIndex        $pIndex;
  97.         $this->_width            = -1;
  98.         $this->_autoSize        false;
  99.         $this->_visible            true;
  100.         $this->_outlineLevel    0;
  101.         $this->_collapsed        false;
  102.  
  103.         // set default index to cellXf
  104.         $this->_xfIndex 0;
  105.     }
  106.     
  107.     /**
  108.      * Get ColumnIndex
  109.      *
  110.      * @return string 
  111.      */
  112.     public function getColumnIndex({
  113.         return $this->_columnIndex;
  114.     }
  115.     
  116.     /**
  117.      * Set ColumnIndex
  118.      *
  119.      * @param string $pValue 
  120.      * @return PHPExcel_Worksheet_ColumnDimension 
  121.      */
  122.     public function setColumnIndex($pValue{
  123.         $this->_columnIndex $pValue;
  124.         return $this;
  125.     }
  126.     
  127.     /**
  128.      * Get Width
  129.      *
  130.      * @return double 
  131.      */
  132.     public function getWidth({
  133.         return $this->_width;
  134.     }
  135.     
  136.     /**
  137.      * Set Width
  138.      *
  139.      * @param double $pValue 
  140.      * @return PHPExcel_Worksheet_ColumnDimension 
  141.      */
  142.     public function setWidth($pValue = -1{
  143.         $this->_width $pValue;
  144.         return $this;
  145.     }
  146.     
  147.     /**
  148.      * Get Auto Size
  149.      *
  150.      * @return bool 
  151.      */
  152.     public function getAutoSize({
  153.         return $this->_autoSize;
  154.     }
  155.     
  156.     /**
  157.      * Set Auto Size
  158.      *
  159.      * @param bool $pValue 
  160.      * @return PHPExcel_Worksheet_ColumnDimension 
  161.      */
  162.     public function setAutoSize($pValue false{
  163.         $this->_autoSize $pValue;
  164.         return $this;
  165.     }
  166.     
  167.     /**
  168.      * Get Visible
  169.      *
  170.      * @return bool 
  171.      */
  172.     public function getVisible({
  173.         return $this->_visible;
  174.     }
  175.     
  176.     /**
  177.      * Set Visible
  178.      *
  179.      * @param bool $pValue 
  180.      * @return PHPExcel_Worksheet_ColumnDimension 
  181.      */
  182.     public function setVisible($pValue true{
  183.         $this->_visible $pValue;
  184.         return $this;
  185.     }
  186.     
  187.     /**
  188.      * Get Outline Level
  189.      *
  190.      * @return int 
  191.      */
  192.     public function getOutlineLevel({
  193.         return $this->_outlineLevel;
  194.     }
  195.     
  196.     /**
  197.      * Set Outline Level
  198.      *
  199.      * Value must be between 0 and 7
  200.      *
  201.      * @param int $pValue 
  202.      * @throws Exception
  203.      * @return PHPExcel_Worksheet_ColumnDimension 
  204.      */
  205.     public function setOutlineLevel($pValue{
  206.         if ($pValue || $pValue 7{
  207.             throw new Exception("Outline level must range between 0 and 7.");
  208.         }
  209.         
  210.         $this->_outlineLevel $pValue;
  211.         return $this;
  212.     }
  213.     
  214.     /**
  215.      * Get Collapsed
  216.      *
  217.      * @return bool 
  218.      */
  219.     public function getCollapsed({
  220.         return $this->_collapsed;
  221.     }
  222.     
  223.     /**
  224.      * Set Collapsed
  225.      *
  226.      * @param bool $pValue 
  227.      * @return PHPExcel_Worksheet_ColumnDimension 
  228.      */
  229.     public function setCollapsed($pValue true{
  230.         $this->_collapsed $pValue;
  231.         return $this;
  232.     }
  233.         
  234.     /**
  235.      * Get index to cellXf
  236.      *
  237.      * @return int 
  238.      */
  239.     public function getXfIndex()
  240.     {
  241.         return $this->_xfIndex;
  242.     }
  243.  
  244.     /**
  245.      * Set index to cellXf
  246.      *
  247.      * @param int $pValue 
  248.      * @return PHPExcel_Worksheet_ColumnDimension 
  249.      */
  250.     public function setXfIndex($pValue 0)
  251.     {
  252.         $this->_xfIndex $pValue;
  253.         return $this;
  254.     }
  255.  
  256.     /**
  257.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  258.      */
  259.     public function __clone({
  260.         $vars get_object_vars($this);
  261.         foreach ($vars as $key => $value{
  262.             if (is_object($value)) {
  263.                 $this->$key clone $value;
  264.             else {
  265.                 $this->$key $value;
  266.             }
  267.         }
  268.     }
  269.  
  270. }

Documentation generated on Tue, 01 Jun 2010 17:02:35 +0200 by phpDocumentor 1.4.3