ColumnDimension.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. /**
  3. * PHPExcel_Worksheet_ColumnDimension
  4. *
  5. * Copyright (c) 2006 - 2015 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 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  25. * @version ##VERSION##, ##DATE##
  26. */
  27. class PHPExcel_Worksheet_ColumnDimension extends PHPExcel_Worksheet_Dimension
  28. {
  29. /**
  30. * Column index
  31. *
  32. * @var int
  33. */
  34. private $columnIndex;
  35. /**
  36. * Column width
  37. *
  38. * When this is set to a negative value, the column width should be ignored by IWriter
  39. *
  40. * @var double
  41. */
  42. private $width = -1;
  43. /**
  44. * Auto size?
  45. *
  46. * @var bool
  47. */
  48. private $autoSize = false;
  49. /**
  50. * Create a new PHPExcel_Worksheet_ColumnDimension
  51. *
  52. * @param string $pIndex Character column index
  53. */
  54. public function __construct($pIndex = 'A')
  55. {
  56. // Initialise values
  57. $this->columnIndex = $pIndex;
  58. // set dimension as unformatted by default
  59. parent::__construct(0);
  60. }
  61. /**
  62. * Get ColumnIndex
  63. *
  64. * @return string
  65. */
  66. public function getColumnIndex()
  67. {
  68. return $this->columnIndex;
  69. }
  70. /**
  71. * Set ColumnIndex
  72. *
  73. * @param string $pValue
  74. * @return PHPExcel_Worksheet_ColumnDimension
  75. */
  76. public function setColumnIndex($pValue)
  77. {
  78. $this->columnIndex = $pValue;
  79. return $this;
  80. }
  81. /**
  82. * Get Width
  83. *
  84. * @return double
  85. */
  86. public function getWidth()
  87. {
  88. return $this->width;
  89. }
  90. /**
  91. * Set Width
  92. *
  93. * @param double $pValue
  94. * @return PHPExcel_Worksheet_ColumnDimension
  95. */
  96. public function setWidth($pValue = -1)
  97. {
  98. $this->width = $pValue;
  99. return $this;
  100. }
  101. /**
  102. * Get Auto Size
  103. *
  104. * @return bool
  105. */
  106. public function getAutoSize()
  107. {
  108. return $this->autoSize;
  109. }
  110. /**
  111. * Set Auto Size
  112. *
  113. * @param bool $pValue
  114. * @return PHPExcel_Worksheet_ColumnDimension
  115. */
  116. public function setAutoSize($pValue = false)
  117. {
  118. $this->autoSize = $pValue;
  119. return $this;
  120. }
  121. }