ColumnDimension.Class.php 2.0 KB

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