Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Worksheet;
   4  
   5  class ColumnDimension extends Dimension
   6  {
   7      /**
   8       * Column index.
   9       *
  10       * @var string
  11       */
  12      private $columnIndex;
  13  
  14      /**
  15       * Column width.
  16       *
  17       * When this is set to a negative value, the column width should be ignored by IWriter
  18       *
  19       * @var float
  20       */
  21      private $width = -1;
  22  
  23      /**
  24       * Auto size?
  25       *
  26       * @var bool
  27       */
  28      private $autoSize = false;
  29  
  30      /**
  31       * Create a new ColumnDimension.
  32       *
  33       * @param string $pIndex Character column index
  34       */
  35      public function __construct($pIndex = 'A')
  36      {
  37          // Initialise values
  38          $this->columnIndex = $pIndex;
  39  
  40          // set dimension as unformatted by default
  41          parent::__construct(0);
  42      }
  43  
  44      /**
  45       * Get column index as string eg: 'A'.
  46       *
  47       * @return string
  48       */
  49      public function getColumnIndex()
  50      {
  51          return $this->columnIndex;
  52      }
  53  
  54      /**
  55       * Set column index as string eg: 'A'.
  56       *
  57       * @param string $pValue
  58       *
  59       * @return $this
  60       */
  61      public function setColumnIndex($pValue)
  62      {
  63          $this->columnIndex = $pValue;
  64  
  65          return $this;
  66      }
  67  
  68      /**
  69       * Get Width.
  70       *
  71       * @return float
  72       */
  73      public function getWidth()
  74      {
  75          return $this->width;
  76      }
  77  
  78      /**
  79       * Set Width.
  80       *
  81       * @param float $pValue
  82       *
  83       * @return $this
  84       */
  85      public function setWidth($pValue)
  86      {
  87          $this->width = $pValue;
  88  
  89          return $this;
  90      }
  91  
  92      /**
  93       * Get Auto Size.
  94       *
  95       * @return bool
  96       */
  97      public function getAutoSize()
  98      {
  99          return $this->autoSize;
 100      }
 101  
 102      /**
 103       * Set Auto Size.
 104       *
 105       * @param bool $pValue
 106       *
 107       * @return $this
 108       */
 109      public function setAutoSize($pValue)
 110      {
 111          $this->autoSize = $pValue;
 112  
 113          return $this;
 114      }
 115  }