0
0

Column.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * PHPExcel_Worksheet_Column
  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_Column
  28. {
  29. /**
  30. * PHPExcel_Worksheet
  31. *
  32. * @var PHPExcel_Worksheet
  33. */
  34. private $parent;
  35. /**
  36. * Column index
  37. *
  38. * @var string
  39. */
  40. private $columnIndex;
  41. /**
  42. * Create a new column
  43. *
  44. * @param PHPExcel_Worksheet $parent
  45. * @param string $columnIndex
  46. */
  47. public function __construct(PHPExcel_Worksheet $parent = null, $columnIndex = 'A')
  48. {
  49. // Set parent and column index
  50. $this->parent = $parent;
  51. $this->columnIndex = $columnIndex;
  52. }
  53. /**
  54. * Destructor
  55. */
  56. public function __destruct()
  57. {
  58. unset($this->parent);
  59. }
  60. /**
  61. * Get column index
  62. *
  63. * @return string
  64. */
  65. public function getColumnIndex()
  66. {
  67. return $this->columnIndex;
  68. }
  69. /**
  70. * Get cell iterator
  71. *
  72. * @param integer $startRow The row number at which to start iterating
  73. * @param integer $endRow Optionally, the row number at which to stop iterating
  74. * @return PHPExcel_Worksheet_CellIterator
  75. */
  76. public function getCellIterator($startRow = 1, $endRow = null)
  77. {
  78. return new PHPExcel_Worksheet_ColumnCellIterator($this->parent, $this->columnIndex, $startRow, $endRow);
  79. }
  80. }