| 1 |
<?php |
| 2 |
|
| 3 |
namespace TablePress\PhpOffice\PhpSpreadsheet\Worksheet; |
| 4 |
|
| 5 |
class PageMargins |
| 6 |
{ |
| 7 |
/** |
| 8 |
* Left. |
| 9 |
*/ |
| 10 |
private float $left = 0.7; |
| 11 |
|
| 12 |
/** |
| 13 |
* Right. |
| 14 |
*/ |
| 15 |
private float $right = 0.7; |
| 16 |
|
| 17 |
/** |
| 18 |
* Top. |
| 19 |
*/ |
| 20 |
private float $top = 0.75; |
| 21 |
|
| 22 |
/** |
| 23 |
* Bottom. |
| 24 |
*/ |
| 25 |
private float $bottom = 0.75; |
| 26 |
|
| 27 |
/** |
| 28 |
* Header. |
| 29 |
*/ |
| 30 |
private float $header = 0.3; |
| 31 |
|
| 32 |
/** |
| 33 |
* Footer. |
| 34 |
*/ |
| 35 |
private float $footer = 0.3; |
| 36 |
|
| 37 |
/** |
| 38 |
* Create a new PageMargins. |
| 39 |
*/ |
| 40 |
public function __construct() |
| 41 |
{ |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Get Left. |
| 46 |
*/ |
| 47 |
public function getLeft(): float |
| 48 |
{ |
| 49 |
return $this->left; |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Set Left. |
| 54 |
* |
| 55 |
* @return $this |
| 56 |
*/ |
| 57 |
public function setLeft(float $left) |
| 58 |
{ |
| 59 |
$this->left = $left; |
| 60 |
|
| 61 |
return $this; |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Get Right. |
| 66 |
*/ |
| 67 |
public function getRight(): float |
| 68 |
{ |
| 69 |
return $this->right; |
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* Set Right. |
| 74 |
* |
| 75 |
* @return $this |
| 76 |
*/ |
| 77 |
public function setRight(float $right) |
| 78 |
{ |
| 79 |
$this->right = $right; |
| 80 |
|
| 81 |
return $this; |
| 82 |
} |
| 83 |
|
| 84 |
/** |
| 85 |
* Get Top. |
| 86 |
*/ |
| 87 |
public function getTop(): float |
| 88 |
{ |
| 89 |
return $this->top; |
| 90 |
} |
| 91 |
|
| 92 |
/** |
| 93 |
* Set Top. |
| 94 |
* |
| 95 |
* @return $this |
| 96 |
*/ |
| 97 |
public function setTop(float $top) |
| 98 |
{ |
| 99 |
$this->top = $top; |
| 100 |
|
| 101 |
return $this; |
| 102 |
} |
| 103 |
|
| 104 |
/** |
| 105 |
* Get Bottom. |
| 106 |
*/ |
| 107 |
public function getBottom(): float |
| 108 |
{ |
| 109 |
return $this->bottom; |
| 110 |
} |
| 111 |
|
| 112 |
/** |
| 113 |
* Set Bottom. |
| 114 |
* |
| 115 |
* @return $this |
| 116 |
*/ |
| 117 |
public function setBottom(float $bottom) |
| 118 |
{ |
| 119 |
$this->bottom = $bottom; |
| 120 |
|
| 121 |
return $this; |
| 122 |
} |
| 123 |
|
| 124 |
/** |
| 125 |
* Get Header. |
| 126 |
*/ |
| 127 |
public function getHeader(): float |
| 128 |
{ |
| 129 |
return $this->header; |
| 130 |
} |
| 131 |
|
| 132 |
/** |
| 133 |
* Set Header. |
| 134 |
* |
| 135 |
* @return $this |
| 136 |
*/ |
| 137 |
public function setHeader(float $header) |
| 138 |
{ |
| 139 |
$this->header = $header; |
| 140 |
|
| 141 |
return $this; |
| 142 |
} |
| 143 |
|
| 144 |
/** |
| 145 |
* Get Footer. |
| 146 |
*/ |
| 147 |
public function getFooter(): float |
| 148 |
{ |
| 149 |
return $this->footer; |
| 150 |
} |
| 151 |
|
| 152 |
/** |
| 153 |
* Set Footer. |
| 154 |
* |
| 155 |
* @return $this |
| 156 |
*/ |
| 157 |
public function setFooter(float $footer) |
| 158 |
{ |
| 159 |
$this->footer = $footer; |
| 160 |
|
| 161 |
return $this; |
| 162 |
} |
| 163 |
|
| 164 |
public static function fromCentimeters(float $value): float |
| 165 |
{ |
| 166 |
return $value / 2.54; |
| 167 |
} |
| 168 |
|
| 169 |
public static function toCentimeters(float $value): float |
| 170 |
{ |
| 171 |
return $value * 2.54; |
| 172 |
} |
| 173 |
|
| 174 |
public static function fromMillimeters(float $value): float |
| 175 |
{ |
| 176 |
return $value / 25.4; |
| 177 |
} |
| 178 |
|
| 179 |
public static function toMillimeters(float $value): float |
| 180 |
{ |
| 181 |
return $value * 25.4; |
| 182 |
} |
| 183 |
|
| 184 |
public static function fromPoints(float $value): float |
| 185 |
{ |
| 186 |
return $value / 72; |
| 187 |
} |
| 188 |
|
| 189 |
public static function toPoints(float $value): float |
| 190 |
{ |
| 191 |
return $value * 72; |
| 192 |
} |
| 193 |
} |
| 194 |
|