PluginProbe
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin / 6.5.1.7
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin v6.5.1.7
6.5.1.7 6.5.1.6 6.5.1.5 6.5.1.4 6.5.1.3 6.5.1.2 6.5.1.1 6.5.0.9 6.5.0.8 6.5.0.7 6.5.0.6 trunk 3.4.2.40 3.4.2.41 3.4.2.42 3.4.2.43 3.4.2.44 3.4.2.45 3.4.2.46 3.4.2.47 3.4.2.48 3.4.2.49 3.4.2.50 6.3.2 6.3.3.1 All 47 releases
wpdatatables / lib / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Worksheet / RowDimension.php

RowDimension.php in wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin 6.5.1.7, at lib/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php

119 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PhpOffice\PhpSpreadsheet\Worksheet;
4
5 use PhpOffice\PhpSpreadsheet\Helper\Dimension as CssDimension;
6
7 class RowDimension extends Dimension
8 {
9 /**
10 * Row index.
11 *
12 * @var ?int
13 */
14 private $rowIndex;
15
16 /**
17 * Row height (in pt).
18 *
19 * When this is set to a negative value, the row height should be ignored by IWriter
20 *
21 * @var float
22 */
23 private $height = -1;
24
25 /**
26 * ZeroHeight for Row?
27 *
28 * @var bool
29 */
30 private $zeroHeight = false;
31
32 /**
33 * Create a new RowDimension.
34 *
35 * @param ?int $index Numeric row index
36 */
37 public function __construct($index = 0)
38 {
39 // Initialise values
40 $this->rowIndex = $index;
41
42 // set dimension as unformatted by default
43 parent::__construct(null);
44 }
45
46 /**
47 * Get Row Index.
48 */
49 public function getRowIndex(): ?int
50 {
51 return $this->rowIndex;
52 }
53
54 /**
55 * Set Row Index.
56 *
57 * @return $this
58 */
59 public function setRowIndex(int $index)
60 {
61 $this->rowIndex = $index;
62
63 return $this;
64 }
65
66 /**
67 * Get Row Height.
68 * By default, this will be in points; but this method also accepts an optional unit of measure
69 * argument, and will convert the value from points to the specified UoM.
70 * A value of -1 tells Excel to display this column in its default height.
71 *
72 * @return float
73 */
74 public function getRowHeight(?string $unitOfMeasure = null)
75 {
76 return ($unitOfMeasure === null || $this->height < 0)
77 ? $this->height
78 : (new CssDimension($this->height . CssDimension::UOM_POINTS))->toUnit($unitOfMeasure);
79 }
80
81 /**
82 * Set Row Height.
83 *
84 * @param float $height in points. A value of -1 tells Excel to display this column in its default height.
85 * By default, this will be the passed argument value; but this method also accepts an optional unit of measure
86 * argument, and will convert the passed argument value to points from the specified UoM
87 *
88 * @return $this
89 */
90 public function setRowHeight($height, ?string $unitOfMeasure = null)
91 {
92 $this->height = ($unitOfMeasure === null || $height < 0)
93 ? $height
94 : (new CssDimension("{$height}{$unitOfMeasure}"))->height();
95
96 return $this;
97 }
98
99 /**
100 * Get ZeroHeight.
101 */
102 public function getZeroHeight(): bool
103 {
104 return $this->zeroHeight;
105 }
106
107 /**
108 * Set ZeroHeight.
109 *
110 * @return $this
111 */
112 public function setZeroHeight(bool $zeroHeight)
113 {
114 $this->zeroHeight = $zeroHeight;
115
116 return $this;
117 }
118 }
119