ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
CellAlignment.php
Go to the documentation of this file.
1
<?
php
2
3
namespace
PhpOffice\PhpSpreadsheet\Writer\Xls\Style
;
4
5
use
PhpOffice\PhpSpreadsheet\Style\Alignment
;
6
7
class
CellAlignment
8
{
12
private
static
$horizontalMap
= [
13
Alignment::HORIZONTAL_GENERAL
=> 0,
14
Alignment::HORIZONTAL_LEFT
=> 1,
15
Alignment::HORIZONTAL_RIGHT
=> 3,
16
Alignment::HORIZONTAL_CENTER
=> 2,
17
Alignment::HORIZONTAL_CENTER_CONTINUOUS
=> 6,
18
Alignment::HORIZONTAL_JUSTIFY
=> 5,
19
];
20
24
private
static
$verticalMap
= [
25
Alignment::VERTICAL_BOTTOM
=> 2,
26
Alignment::VERTICAL_TOP
=> 0,
27
Alignment::VERTICAL_CENTER
=> 1,
28
Alignment::VERTICAL_JUSTIFY
=> 3,
29
];
30
31
public
static
function
horizontal
(
Alignment
$alignment
): int
32
{
33
$horizontalAlignment =
$alignment
->getHorizontal();
34
35
if
(is_string($horizontalAlignment) && array_key_exists($horizontalAlignment, self::$horizontalMap)) {
36
return
self::$horizontalMap[$horizontalAlignment];
37
}
38
39
return
self::$horizontalMap[
Alignment::HORIZONTAL_GENERAL
];
40
}
41
42
public
static
function
wrap
(
Alignment
$alignment
): int
43
{
44
$wrap =
$alignment
->getWrapText();
45
46
return
($wrap ===
true
) ? 1 : 0;
47
}
48
49
public
static
function
vertical
(
Alignment
$alignment
): int
50
{
51
$verticalAlignment =
$alignment
->getVertical();
52
53
if
(is_string($verticalAlignment) && array_key_exists($verticalAlignment, self::$verticalMap)) {
54
return
self::$verticalMap[$verticalAlignment];
55
}
56
57
return
self::$verticalMap[
Alignment::VERTICAL_BOTTOM
];
58
}
59
}
php
An exception for terminatinating execution or to throw for unit testing.
PhpOffice\PhpSpreadsheet\Style\Alignment
Definition:
Alignment.php:8
PhpOffice\PhpSpreadsheet\Style\Alignment\HORIZONTAL_CENTER_CONTINUOUS
const HORIZONTAL_CENTER_CONTINUOUS
Definition:
Alignment.php:14
PhpOffice\PhpSpreadsheet\Style\Alignment\HORIZONTAL_JUSTIFY
const HORIZONTAL_JUSTIFY
Definition:
Alignment.php:15
PhpOffice\PhpSpreadsheet\Style\Alignment\HORIZONTAL_CENTER
const HORIZONTAL_CENTER
Definition:
Alignment.php:13
PhpOffice\PhpSpreadsheet\Style\Alignment\VERTICAL_BOTTOM
const VERTICAL_BOTTOM
Definition:
Alignment.php:20
PhpOffice\PhpSpreadsheet\Style\Alignment\HORIZONTAL_GENERAL
const HORIZONTAL_GENERAL
Definition:
Alignment.php:10
PhpOffice\PhpSpreadsheet\Style\Alignment\HORIZONTAL_LEFT
const HORIZONTAL_LEFT
Definition:
Alignment.php:11
PhpOffice\PhpSpreadsheet\Style\Alignment\HORIZONTAL_RIGHT
const HORIZONTAL_RIGHT
Definition:
Alignment.php:12
PhpOffice\PhpSpreadsheet\Style\Alignment\VERTICAL_JUSTIFY
const VERTICAL_JUSTIFY
Definition:
Alignment.php:23
PhpOffice\PhpSpreadsheet\Style\Alignment\VERTICAL_CENTER
const VERTICAL_CENTER
Definition:
Alignment.php:22
PhpOffice\PhpSpreadsheet\Style\Alignment\VERTICAL_TOP
const VERTICAL_TOP
Definition:
Alignment.php:21
PhpOffice\PhpSpreadsheet\Style\Style\$alignment
$alignment
Definition:
Style.php:36
PhpOffice\PhpSpreadsheet\Writer\Xls\Style\CellAlignment
Definition:
CellAlignment.php:8
PhpOffice\PhpSpreadsheet\Writer\Xls\Style\CellAlignment\$horizontalMap
static $horizontalMap
Definition:
CellAlignment.php:12
PhpOffice\PhpSpreadsheet\Writer\Xls\Style\CellAlignment\vertical
static vertical(Alignment $alignment)
Definition:
CellAlignment.php:49
PhpOffice\PhpSpreadsheet\Writer\Xls\Style\CellAlignment\wrap
static wrap(Alignment $alignment)
Definition:
CellAlignment.php:42
PhpOffice\PhpSpreadsheet\Writer\Xls\Style\CellAlignment\$verticalMap
static $verticalMap
Definition:
CellAlignment.php:24
PhpOffice\PhpSpreadsheet\Writer\Xls\Style\CellAlignment\horizontal
static horizontal(Alignment $alignment)
Definition:
CellAlignment.php:31
PhpOffice\PhpSpreadsheet\Writer\Xls\Style
Definition:
CellAlignment.php:3
libs
composer
vendor
phpoffice
phpspreadsheet
src
PhpSpreadsheet
Writer
Xls
Style
CellAlignment.php
Generated on Thu Oct 2 2025 19:01:10 for ILIAS by
1.9.4 (using
Doxyfile
)