CellIterator.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. abstract class PHPExcel_Worksheet_CellIterator
  8. {
  9. /**
  10. * PHPExcel_Worksheet to iterate
  11. *
  12. * @var PHPExcel_Worksheet
  13. */
  14. protected $subject;
  15. /**
  16. * Current iterator position
  17. *
  18. * @var mixed
  19. */
  20. protected $position = null;
  21. /**
  22. * Iterate only existing cells
  23. *
  24. * @var boolean
  25. */
  26. protected $onlyExistingCells = false;
  27. /**
  28. * Destructor
  29. */
  30. public function __destruct()
  31. {
  32. unset($this->subject);
  33. }
  34. /**
  35. * Get loop only existing cells
  36. *
  37. * @return boolean
  38. */
  39. public function getIterateOnlyExistingCells()
  40. {
  41. return $this->onlyExistingCells;
  42. }
  43. /**
  44. * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
  45. *
  46. * @throws PHPExcel_Exception
  47. */
  48. abstract protected function adjustForExistingOnlyRange();
  49. /**
  50. * Set the iterator to loop only existing cells
  51. *
  52. * @param boolean $value
  53. * @throws PHPExcel_Exception
  54. */
  55. public function setIterateOnlyExistingCells($value = true)
  56. {
  57. $this->onlyExistingCells = (boolean) $value;
  58. $this->adjustForExistingOnlyRange();
  59. }
  60. }