# tablepress/3.4/libraries/vendor/PhpSpreadsheet/Reader/Xml/Style/Alignment.php

TablePress – Tables in WordPress made easy, version 3.4. 72 lines.

- Page: https://pluginprobe.com/plugins/tablepress/3.4/code/libraries/vendor/PhpSpreadsheet/Reader/Xml/Style/Alignment.php
- Raw: https://pluginprobe.com/plugins/tablepress/3.4/raw/libraries/vendor/PhpSpreadsheet/Reader/Xml/Style/Alignment.php
- Modified: 2025-10-28T04:41:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/tablepress/3.4/code/libraries/vendor/PhpSpreadsheet/Reader/Xml/Style/Alignment.php#L10-L20`.

```php
<?php

namespace TablePress\PhpOffice\PhpSpreadsheet\Reader\Xml\Style;

use TablePress\PhpOffice\PhpSpreadsheet\Style\Alignment as AlignmentStyles;
use SimpleXMLElement;

class Alignment extends StyleBase
{
	protected const VERTICAL_ALIGNMENT_STYLES = [
		AlignmentStyles::VERTICAL_BOTTOM,
		AlignmentStyles::VERTICAL_TOP,
		AlignmentStyles::VERTICAL_CENTER,
		AlignmentStyles::VERTICAL_JUSTIFY,
	];

	protected const HORIZONTAL_ALIGNMENT_STYLES = [
		AlignmentStyles::HORIZONTAL_GENERAL,
		AlignmentStyles::HORIZONTAL_LEFT,
		AlignmentStyles::HORIZONTAL_RIGHT,
		AlignmentStyles::HORIZONTAL_CENTER,
		AlignmentStyles::HORIZONTAL_CENTER_CONTINUOUS,
		AlignmentStyles::HORIZONTAL_JUSTIFY,
	];

	/** @return mixed[] */
	public function parseStyle(SimpleXMLElement $styleAttributes): array
	{
		$style = [];

		foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
			$styleAttributeValue = (string) $styleAttributeValue;
			switch ($styleAttributeKey) {
				case 'Vertical':
					if (self::identifyFixedStyleValue(self::VERTICAL_ALIGNMENT_STYLES, $styleAttributeValue)) {
						$style['alignment']['vertical'] = $styleAttributeValue;
					}

					break;
				case 'Horizontal':
					if (self::identifyFixedStyleValue(self::HORIZONTAL_ALIGNMENT_STYLES, $styleAttributeValue)) {
						$style['alignment']['horizontal'] = $styleAttributeValue;
					}

					break;
				case 'WrapText':
					$style['alignment']['wrapText'] = true;

					break;
				case 'Rotate':
					$style['alignment']['textRotation'] = $styleAttributeValue;

					break;
				case 'Indent':
					$style['alignment']['indent'] = $styleAttributeValue;

					break;
				case 'ReadingOrder':
					if ($styleAttributeValue === 'RightToLeft') {
						$style['alignment']['readOrder'] = AlignmentStyles::READORDER_RTL;
					} elseif ($styleAttributeValue === 'LeftToRight') {
						$style['alignment']['readOrder'] = AlignmentStyles::READORDER_LTR;
					}

					break;
			}
		}

		return $style;
	}
}

```
